Linking a DLL
I'm very new to making use of 'open source' libraries in my C programs. I'm currently trying to use the GD graphics library. This library can be used by linking my program to a dll. Forgive me if this is a stupid question, but how do I go about linking my program to the dll? Is it done in the c source code or do I have to tell my compiler (Digital Mars) to do it?
Thanks for any help you guys may be able to offer,
In general you can not link to a dll. You need to have a library to make the linker happy. Usually compilers allready install import-libraries for all kind of system-dlls. If you don't have an importlibrary for a certain dll there is usually some tool that comes with your compiler that allows you to generate such an import library from the dll and some definition-file ( or the header ).
Another possibility is to explicitly link to the dll by calling OS-functions like loadlibrary() and GetProcAdress() at runtime.
Thanks. Also supplied with the dll was a ".a" file and this is in the documentation:
'users can simply link with the provided libbgd.a stub library in order to use the DLL'
Is there a C function I can use to link to this 'stub library'?
You have to add that library to the linker options of your build-tool. usually some option like -lbgd in your case.
sorry don't know about Digital-Mars.