Skip to content

Static class name causes an error when loading into the same process from different dylibs #29

@ilmai

Description

@ilmai

Name of the issue is what I'm imagining is going on anyway.

I'm creating an audio effect plugin for use in DAWs (Digital Audio Workstations). The plugin is being distributed in two formats, CLAP and VST3, which for the purposes of this bug just means that they're separate dylibs. Now, I can add multiple instances of the plugin just fine if they're the same format, but adding two plugins with different formats causes the following error:

panicked at /Users/.../.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/raw-window-metal-1.0.0/src/observer.rs:12:1:
could not create new class RawWindowMetalLayer. Perhaps a class with that name already exists?

If I understand the situation right, one of the dylibs is trying to create a class instance with a name that the other dylib has already used. Presumably the same error would happen if there was another plugin using this crate.

The way I'm solving this in my own code is that I'm adding a random prefix to any ObjC class names I'm declaring to avoid this exact error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions