55 lines
926 B
C++
55 lines
926 B
C++
// test_lib_dyn.cpp : Defines the entry point for the DLL application.
|
|
//
|
|
|
|
|
|
#include "../test_lib_static/test_static.h"
|
|
|
|
#ifdef WIN32
|
|
|
|
#include "test_lib_dyn.h"
|
|
|
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
|
DWORD ul_reason_for_call,
|
|
LPVOID lpReserved
|
|
)
|
|
{
|
|
A* p = new A;
|
|
switch (ul_reason_for_call)
|
|
{
|
|
case DLL_PROCESS_ATTACH:
|
|
func1();
|
|
p->method1();
|
|
case DLL_THREAD_ATTACH:
|
|
case DLL_THREAD_DETACH:
|
|
case DLL_PROCESS_DETACH:
|
|
break;
|
|
}
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
// This is an example of an exported variable
|
|
TEST_LIB_DYN_API int ntest_lib_dyn=0;
|
|
|
|
// This is an example of an exported function.
|
|
TEST_LIB_DYN_API int fntest_lib_dyn(void)
|
|
{
|
|
return 42;
|
|
}
|
|
|
|
// This is the constructor of a class that has been exported.
|
|
// see test_lib_dyn.h for the class definition
|
|
Ctest_lib_dyn::Ctest_lib_dyn()
|
|
{
|
|
return;
|
|
}
|
|
#else
|
|
void init()
|
|
{
|
|
A* p = new A;
|
|
func1();
|
|
p->method1();
|
|
}
|
|
#endif
|
|
|