Re: FCP FxPlug load order - how do I control?
Re: FCP FxPlug load order - how do I control?
- Subject: Re: FCP FxPlug load order - how do I control?
- From: Peter Litwinowicz <email@hidden>
- Date: Wed, 25 Jun 2008 15:28:13 -0700
- Thread-topic: FCP FxPlug load order - how do I control?
Title: Re: FCP FxPlug load order - how do I control?
> I should have been more clear. They are independent plugins that happen
> to have some C++ classes in each that are named the same.
>
> Say I have a C++ class GlobalStuff in each one, and it's declared
> statically. The second one to load is calling into the methods of the
> instance in v1, even though they are declared statically. This doesn't
> happen with similar code in other hosts.
To Paul M.,
Hopefully you are using GCC 4 or later. I found the info below on the web here http://gcc.gnu.org/wiki/Visibility and was instrumental in getting our FxPlugs working properly (because we ran into what you are running into). It’s not a host problem. It’s a C/C++ compiled code loading problem in Objective-C hosts. Blame the compiler/linker writers! However, there IS an easy fix.
First: put this in whatever include file you put in all your code (we have a global prefix file we use in every source file, hopefully you do too):
#ifdef _MSC_VER
#ifdef BUILDING_DLL
#define DLLEXPORT __declspec(dllexport)
#else
#define DLLEXPORT __declspec(dllimport)
#endif
#define DLLLOCAL
#else
#ifdef HAVE_GCCVISIBILITYPATCH
#define DLLEXPORT __attribute__ ((visibility("default")))
#define DLLLOCAL __attribute__ ((visibility("hidden")))
#else
#define DLLEXPORT
#define DLLLOCAL
#endif
#endif
#endif
Then in your list of preprocessing macros define HAVE_GCCVISIBILITYPATCH . By having the HAVE_GCCVISIBILITYPATCH macro, you can turn the export ability on and off if your compiler doesn’t support it (basically GNU 4.0 or later, which we use on both Mac and Linux).
To make every function/variable/C++ class instantiations etc. hidden by default, you will wish to add the -fvisibility=hidden and -fvisibility-inlines-hidden options to the command line arguments of every GCC invocation (thus, one piece of code from one shared lib will not call into another, nor access the wrong instance of a global variable that has the same name in two plugins).
To make a routine or variable exposed to the outside world (that is, from one shared lib to another, or between host and shared lib), declare your function:
DLLEXPORT void exportedFunction(args...);
Pete
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden