On Wednesday, 26 February 2014 at 14:41:02 UTC, Adam D. Ruppe wrote:
You'd do it the same way you do in C. On Windows, call LoadLibrary, FreeLibrary, and GetProcAddress or the COM functions. On Linux, the family of functions is dlopen, dlsym, and dlclose.

Knowing the types to pass the functions is gonna be tricky and this needs to be right to avoid crashes. On Windows with scripting language, this is often done through COM automation: the IDispatch interface. With regular C functions, you really just have to know the prototypes ahead of time... it won't be fully dynamic, you load the library at run time but know how to use it at compile time.

That's the way I do it but I was wondering. Is it better to load all the functions from the DLL at the start of the program or load them when required and keep having to check if they're loaded before each use?

-<Mike>-

Reply via email to