I know in Windows you would do something like LoadLibrary and then set your function pointer with GetProcAddress,
But how would something similar be done in Linux or OSX? The reason being is that I want to develop a plug in system for my X platform application.
Thanks
You are looking for dlopen
(analogous to LoadLibrary), dlclose
(analogous to FreeLibrary) and dlsym
(analogous to GetProcAddress).
You can use dlopen
and friends on both Linux and Mac OS X (this Mac man page should work for both). Note, however, that you need to be careful not to mix 32-bit and 64-bit code and libraries; on the Mac, just make sure that the libraries are "universal binaries."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With