Re: [Dev-C++] Use dll libraries with Dev-C++
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Quan Zongliang(Gmail) <qua...@gm...> - 2007-04-04 02:14:26
|
Example at http://en.wikipedia.org/wiki/Dynamic_link_library: #include <windows.h> #include <stdio.h> // DLL function signature typedef double (*importFunction)(double, double); int main(int argc, char **argv) { importFunction addNumbers; double result; // Load DLL file HINSTANCE hinstLib = LoadLibrary("Example.dll"); if (hinstLib == NULL) { printf("ERROR: unable to load DLL\n"); return 1; } // Get function pointer addNumbers = (importFunction)GetProcAddress(hinstLib, "AddNumbers"); if (addNumbers == NULL) { printf("ERROR: unable to find DLL function\n"); FreeLibrary(hinstLib); return 1; } // Call function. result = addNumbers(1, 2); // Unload DLL file FreeLibrary(hinstLib); // Display result printf("The result was: %f\n", result); return 0; } Regards. On Tue, 3 Apr 2007 16:46:41 +0100 "Pedro Sousa" <ped...@gm...> wrote: > Hi, > > Sorry for the silly question, but I've not find the solution throw googling. > > How can I use dll files in a Dev-C++ project. I need to use functions > declared in a dll file and I didn't found how can I do it. > > Thanks in advance > Pedro Sousa ----------------------------------------------- Zongliang Quan qua...@gm...,qua...@ho... Admin by http://postgresql.oss.tw http://postgresql-chinese.blogspot.com |