Hallo!

In my program, that is at the moment targeted to Linux only, I use shared libraries. You can load them at runtime with dlopen and use dlgetsym to get function pointers to symbols in the library. You can also create FOX widgets in them, but then you must pass the pointer to the fxApp and maybe to the main window to the plugin.
With dlgetsym I only get the function pointers for pure C functions (delcared with extern "C") other functions that use C++ classes as parameters and/or return values I pass from the application to the plugin with self-written functions because some information on the used classes is put into these symbol names (mangling). I just pass void* pointers of the functions and assure that the plugin knows how the functions are declared.

I think with gcc you could delcare your functions static and pass the -Wl,-E flag to the compiler. That tells the linker to pass statically declared symbols to the shared objects of the program. For example you must use that when you embed Python into your program and want to call Python C-functions for that embedded python interpreter in your plugin, because the python library creates some static data it depends on when processing these calls.

I know this works on win32 more or less the same way but I don't know the api there.

Its some time ago but I should have some small testcode for linux at home. I can send it to you, if you want to.

You can also try

man dlopen

on Linux for some information.

Gru,

Stephan


Mathias Gumz <gumz@mail.CS.Uni-Magdeburg.De> schrieb am 08.03.02:
> hello everyone,
> 
> i want to use kind of plugins for my program. how could that be done on
> unix/win32 in an easy way.
> 
> the plugins should contain foxgui elements and some other stuff, no
> multithreading is needed ...
> 
> any suggestions ?
> 
> answers could be a general as you want, its just to get an idea about the
> problem.
> 
> regards
> 
> mathias
> 
