dynamic/shared libraries (again)
BlitzMax Forums/BlitzMax Beginners Area/dynamic/shared libraries (again)
| ||
hello people. I've been trolling the forums and google about this for 2 days, but there doesn't seem to be a proper solution to this yet. My problem is loading dll/so libraries at runtime. I know the pub.win32 module has some functions to do this on windows, but obviously they won't work on linux/macos. Is there a module out there which provides the loadLibraryA/W and GetProcAddress functionality for linux/macos? |
| ||
On macos the equivalent to a .dll is called a dylib. severaly of Brucey's modules use them, so you could look at the source to those for some pointers. Cheers Charlie |
| ||
You want dlopen, dlsym, and dlclose (see man pages) for Linux and Mac OS. For Mac OS, you'll just use the 'dylib' extension instead of the usual 'so'. More info on dynamic libraries in Mac OS: http://developer.apple.com/DOCUMENTATION/DeveloperTools/Conceptual/DynamicLibraries/000-Introduction/Introduction.html |
| ||
great. thanks! |
| ||
Better yet if you have a cross-platform library already compiled for each platform you likely have a .lib file which you can declare:'?Win32 Import "newton.lib" Import "jointlibrary.lib" '? ?MacOS Import "newton32.a" ? ?Linux Import "newton.a" ? Extern ' Functions here... EndExtern And be sure to supply the appropriate compiled versions. |
| ||
Based on what I've heard, he doesn't. |