Archived

This topic is now archived and is closed to further replies.

Salec

Multi OS Plugin system

Recommended Posts

Hello, I am currently developing a plugin system. Bassically each plugin gives the program the ability to support a new file format. Currently, the plugins are dynamic link libraries. This system is working great with no problems at all. It will not run on another OS however. This is because the .dll format is windows specific. Is there any method of writing a plugin system that supports Multiple operating systems? -Salec

Share this post


Link to post
Share on other sites
As Magmai said, there are also libraries for Unix. There is a visual studio wizard that will generate a skeleton project for you to build a dll on windows platforms, and provides some #define''s and a makefile so that it will also build into a unix library. I can''t find the URL right now, but someone else may have it handy.

Share this post


Link to post
Share on other sites
Look for the dl library on Linux. I believe the functions of interest are dlopen(), dlsym(), and dlfree() (but I could be remembering them wrong). They work very very similar to LoadLibrary(), GetProcAddress(), and FreeLibrary() (respectively).


-Brannon

Share this post


Link to post
Share on other sites
Mac OS9 and OSX both have shared libraries as well.

Just make sure you don''t require code in the DLLMain() of the DLL.

There is no such thing as DLLMain on the Mac.

Share this post


Link to post
Share on other sites
None of my code requires any windows specific features in the plugins. I have the library for unix to create .so files and use dlOpen etc. But must I recompile my code for each OS. What I would like to have it just 1 plugin file that would work on all OS''s.

-Salec

Share this post


Link to post
Share on other sites
quote:
Original post by Salec
But must I recompile my code for each OS. What I would like to have it just 1 plugin file that would work on all OS''s.

you have to do this with anything you compile.

--- krez (krezisback@aol.com)

Share this post


Link to post
Share on other sites
quote:

Just make sure you don''t require code in the DLLMain() of the DLL.



Just FYI, the Win32 docs say the DLLMain() function is optional.
You don''t even need to declare it.

So, this shouldn''t be a problem if you have your own
initialization routines.

Share this post


Link to post
Share on other sites