euan
New member
I'm trying to write a dummy dll for an ancient 3D API, and I can't for the hell of it figure out how to match the original DLL's export type.
The header file defines a macro for exporting the functions as a dll as follows:
An exported function is then declared in the header as follows:
If I look at the export table in the original DLL the function will have 2 items:
3DAPI_Init_lib
_3DAPI_Init@2
So my problem is what is DLLEXPORT? It's not defined anywhere. Is this some ancient MSVC4.0 thing? Or is it just "#define DLLEXPORT __declspec(dllexport)"? I know that if I put the /Gz in the MSVC6 compiler options it will export __declspec(dllexport) functions in the __stdcall format which is the "_functionName@2", and not declaring /Gz will export "functionName". How do I do both at the same time using that macro, or another method. I can't write DLLs like this to save myself! Normal windows stuff is no problem, but things like this just stall my brain.
Oh and I won't mention the API becuase nobody will have ever heard of, nor used it! It doesn't even show up in google!!!
The header file defines a macro for exporting the functions as a dll as follows:
Code:
#if defined (BUILD_AS_DLL)
//export both the function as is and a function pointer
//This allows a GetProcAddress() to work without name mangling
#define PROTOTYPE(function_name, return_type, parameters) \
return_type DLLEXPORT WINAPI function_name parameters; \
typedef return_type (WINAPI *function_name##_t) parameters; \
extern DLLEXPORT function_name##_t function_name##_lib
#else
#define PROTOTYPE(function_name, return_type, parameters) \
typedef return_type (WINAPI *function_name##_t) parameters; \
return_type DLLEXPORT WINAPI function_name parameters;
#endif
An exported function is then declared in the header as follows:
Code:
PROTOTYPE (3DAPI_Init, int, (void));
If I look at the export table in the original DLL the function will have 2 items:
3DAPI_Init_lib
_3DAPI_Init@2
So my problem is what is DLLEXPORT? It's not defined anywhere. Is this some ancient MSVC4.0 thing? Or is it just "#define DLLEXPORT __declspec(dllexport)"? I know that if I put the /Gz in the MSVC6 compiler options it will export __declspec(dllexport) functions in the __stdcall format which is the "_functionName@2", and not declaring /Gz will export "functionName". How do I do both at the same time using that macro, or another method. I can't write DLLs like this to save myself! Normal windows stuff is no problem, but things like this just stall my brain.
Oh and I won't mention the API becuase nobody will have ever heard of, nor used it! It doesn't even show up in google!!!