The library created with the dll is the import library...it tells the linker what the program expects to import......I'm suprised the project links without this library being added to the exe...
The def file is created with the dll project like so
Code:
LIBRARY MyDll
EXPORTS MyExportedFunc
and it tells the linker which functions to add to the dll's export table. I dont know how Devc++ uses def files......I do all my dlls with the Microsoft Linker in VC++ or MASM32 (VC++ has a better method than defs....__declspec(dllexport))......with that linker, if you used a def file you would add def file with the params you send when linking
Ok...if you are sure the dll is fine.....try this
Say the function you are exporting is declared like
int MyExportedFunc(int);....
Adapt this pseudocode and put it in your code
Code:
typedef int (MYEXPORTEDFUNC*)(int);
MYEXPORTEDFUNC lpfMyExportedFunc;
HMODULE hMod = LoadLibrary("MyDll.dll");
if(!hMod){
Errorhandler();
return;
}
lpfMyExportedFun =
(MYEXPORTEDFUNC)GetProcAddress(hMod,"MyExportedFunc");
if(!lpfMyExportedFun){
Errorhandler();
return;
}
/*Use func*/
int nRes = lpfMyExportedFunc(50);
FreeLibrary(hMod);
lpfMyExportedFunc = NULL;
Here you are loading the dll at runtime and finding where the function you need is...then you are assigning it to a function pointer and then calling it.
I havent tested the above, but all those functions are on MSDN