Assuming you have created a DLL that EXPORTS a bunch of funtions and you want to use these functions
in a program without having to include the code for these functions..
1) you have to declare prototypes for your functions:
For example, int my_function1(int , char) is such declaration
2) you need a .lib file to make the linker capable to create the IMPORT table of the program (not the dll)
To create such file you need to edit a .def file:
For example, here is a such file i have been using to create my own crt.lib file to compile a program:
LIBRARY CRTDLL
EXPORTS
malloc
menset
free
fopen
fclose
fread
fscanf
sprintf
comments:
first line is the name of the dll that exports the functions wich names are following
you need to replace "CRTDLL" string by "MY_DLL" if your dll is named "MY_DLL" (better to use upper case characters)
words "LIBRARY" and "EXPORTS" are reserved words of polib.exe, the program needed to create the .lib file (it's a program included in Pelles-C package)
To create a .lib file lauching polib.exe from console box execute:
polib.exe /DEF:myfile.def /OUT:mylib.lib
To compile your project using the GUI of Pelles-C you'll need to change options of this project to tell linker to take into account the .lib created (corresponding to your dll functions you want to use dynamically in your program)
in the GUI: project/project options/linker and add your lib in the first line that shows a list of .lib (and eventually .obj). No need to change the last line, it's updated automatically it seems.
Speaking about polib, i'm a dirty coder, i work generally on small projects, i don't need, most of the time, to create a makefile but if someone could explain me the syntax to put in the makefile commands to use polib to create a .lib you're welcome