JUCE_ObjCExtraSuffix - How to?


#1

Hello,

I’m facing plugins that crash each others, and it seems that I may have to specify JUCE_ObjCExtraSuffix, though I didn’t succeed so far.

I’ve just tried

#define JUCE_ObjCExtraSuffix 1960
in include.h, and in juce_LibrarySource.mm before to include juce amalgamated, but it made no difference.

So how is it done usually ? Should I also define kJUCEClass ?

I don’t see such variable specified done in JuceDemoPlugin, maybe there should be an example in there ?

Any help is welcomed !

Salvator


#2

That sounds like you’re doing it right. Maybe it’s working, but something else is crashing?


#3

Hello,

I assumed the define was not working because when inserting jucedemoplugin after my own, I was getting 12 errors messages like this :

But today, it’s not crashing anymore so far! Don’t know why, I just recompiled (which I already did previously ,and after cleaning too).
Anyway it seems happy for now, though there’s still 1 error reported :

A few questions :
1- what about defining JUCE_ObjCExtraSuffix in the jucedemoplugin ? You would teach us the good example :slight_smile: (Or at least put the define line in place where it has to be used)
2-So no need for me to even look at kJUCEClass ?
3- would that be possible to link JucePlugin_PluginCode to JUCE_ObjCExtraSuffix so it would be taken care of automatically ?

Thanks,

Salvator


#4

Ah - thanks, looks like I forgot to fix that openGL class name. I’ll sort that out today. I never noticed that it produced linker warnings like that - very useful!

Erm… kJUCEClass rings a bell, but I can’t find any such constant in the code (?)

It’d be a bit tricky to add the suffix to the plugin code because it’d somehow need to be included in all the plugin files in your project. I guess I could add another value to the plugin characteristics file for this, but I’d have thought that JucePlugin_PluginCode should be unique anyway?


#5

Does JUCE_ObjCExtraSuffix need to be an int? Or can it be some other identifier? e.g. MyPlugin ?


#6

It can be any kind of token - it just gets tagged onto the end of the class names


#7

OK, thanks. I just wasn’t sure if it got used in some comparison somewhere as well as being tagged on the end of class names…


#8

No, don’t think it’s used in other ways.

I made it a number with the intention of writing some sort of automatic update script to increment it when I did a build, but never got round to doing so.


#9

Hi Jules,

Quick question :
I’ve tried in “juce_LibrarySource.mm” to define :

,and it seems to work fine (i.e : in AULAB there is no more conflict messages when loading both jucedemoplugin & my own plugin).

Since it work, I guess it is not necessary to define again JUCE_ObjCExtraSuffix in “includes.h” as well (as there’s a #include “…/…/…/…/juce_amalgamated.h” in there) ?

Thanks,
Salvator


#10

BTW I’m defining JUCE_ObjCExtraSuffix in a preprocessor macro in Xcode. But that’s only since I was too lazy to change the way my project’s files are organised.

I was going to look at using JucePlugin_PluginCode as the suffix as this should be unique per plugin anyway.


#11

…actaully I’m finding that I need to make sure JucePlugin_AUExportPrefix (and therefore JucePlugin_AUExportPrefixQuoted) needs to be unique too. Does this sound right? or perhaps I’ve hacked something somewhere…


#12

Yes, that’s the same kind of thing, but used in the AU wrapper code.


#13

My plugin crashed if i used the VST and the Audio Unit version in Ableton Live at the same time. I expected something in the image cache… but now i know the reason. I’m a juce newbie, it seems that this framework has a solution for every problem :smiley:

After i set ObjCExtraSuffix=PluginNameVST and ObjCExtraSuffix=PluginNameAU in the pre compiler macro definition of my XCode 3 project, the plugins work simultaneous without any problem. Thanks for that!


#14

I also had similar issues with both VST and AU versions of JuceDemoPlugin working under Live (crash very time) - described here http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=4491

I’ve compiled VST and AU versions with different CObjExtraSuffix values but it doesn’t change anything in my case :frowning:

Cheers,
Przemek


#15

I can’t think of any possible way they could interact, except for an ObjC name clash. The two things are running in separate modules, so no statics are shared between them.

So I’d say that either I’ve forgotten to fix one of my class names (but I don’t think this is the case), or that you’re not running the code that you think you are - e.g. maybe it’s not fully re-built or you’re opening the wrong copy of the plugin, etc.


#16

Or one thought: you’re not using a symbolic link to point both types of plugin at the same binary file, are you?


#17

No, I’m not. I’m using two completely separate physical files (.vst and .component in their proper folders)
Of course due to the polymorphic plugins mechanism they’re the same in their content.

And I’m sure that I’m running proper code. I always clean all targets with dependencies, delete manually external files, rebuild everything etc.

But I found something interesting with this issue. However it may not depend only on the JUCE_ObjCExtraSuffix so I’m replying it in my original post => http://www.rawmaterialsoftware.com/juceforum/viewtopic.php?t=4491


#18

I don’t seem to get this: what do I do when I don’t use the amalgamated version but link to the JUCE library? The way I currently understand it is that I have to rebuild the JUCE library with different values of JUCE_ObjCExtraSuffix defined in juce_mac_NativeCode.mm for every plugin, but that can’t be the case, right?


#19

That is indeed the case. The obj-C names are part of the library code, so there’s no way to change them without recompiling it.


#20

Argh! That’s unfortunate. Aaah, whatever, keeps me busy, I guess… 8)