Example of a DLL created in C++ Exporting three functions:
// BEGIN C++ DLL
// loaddll.cpp : Defines the entry point for the DLL application.
//
#include <windows.h>
#include <stdio.h>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}
#ifdef __cplusplus // If used by C++ code,
extern "C" { // we need to export the C interface
#endif
__declspec(dllexport) int cfunc1(int i){
return i;
}
__declspec(dllexport) double cfunc2(double *inp){
double rtn = *inp;
rtn++;
return rtn;
}
__declspec(dllexport) char * cfunc3(char *inp){
strcat(inp," + ");
return inp;
}
#ifdef __cplusplus
}
#endif
// END C++ DLL