gdelucce.pcs.crosspost
Including a C DLL in a windev project May 18, 2009 12:21PM |
BLS
Re: Including a C DLL in a windev project May 23, 2009 01:08AM |
#ifdef TESTDLL_EXPORTS #define WDEXPORT extern "C" __declspec(dllexport) #else #define WDEXPORT extern "C" __declspec(dllimport) #endif // define your exported functions WDEXPORT int fntestdll(void); WDEXPORT void fninc(int* intptr);
#include "stdafx.h" #include "testdll.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } // This is an example of exported functions. WDEXPORT int fntestdll(void) { return 42; // what else } WDEXPORT void fninc(int* intptr) { ++*intptr; } //WINDEV res is int = API("TestDLL", "fntestdll") //or res is int = 100 API("TestDLL", "fninc", &res) Trace(res) // 101