I was looking at documentation for exporting functions, and it stated __declspec(dllexport) should be used before the command line version -EXPORT: if possible. I'm currently using the command line variant. In attempting to make these changes I'm trying to understand the correct implementation, but I'm running into problems.
DLL's header file:
#ifdef LIBRARY_EXPORTS
#define LIBRARY_API __declspec(dllexport)
#else
#define LIBRARY_API __declspec(dllimport)
#endif
#define PRINT_TEST(name) LIBRARY_API void name()
typedef PRINT_TEST(print_log);
// ^ What's the C++11 equivalent with the using keyword?
DLL's source file:
PRINT_TEST(PrintTest) {
std::cout << "Testing DLL" << std::endl;
}
Application's source file:
print_test* printTest = reinterpret_cast<print_test*>(GetProcAddress(testDLL, "PrintTest"));
Is the issue because of __declspec(dllexport) is included in the typedef? Therefore the statement in the application's source file actually is:
__declspec(dllexport) void (*print_test)() printTest = reinterpret_cast<print_test*>(GetProcAddress(testDLL, "PrintTest"));
I'm not getting any compiler errors or warnings.
GetProcAddress
returning NULL? – 1201ProgramAlarm