07-11-2006 01:28 PM
DLL_THREAD_ATTACHIt seems as if a DLL_PROCESS_ATTACH was never called even though according to MS documentation it should be called when "The DLL is being loaded into the virtual address space of the current process as a result of the process starting up or as a result of a call to LoadLibrary. DLLs can use this opportunity to initialize any instance data or to use the TlsAlloc function to allocate a thread local storage (TLS) index."
DLL_PROCESS_DETACH
DLL_PROCESS_DETACH
DLL_PROCESS_DETACH
DLL_PROCESS_DETACH
DLL_THREAD_DETACH
DLL_PROCESS_DETACH
07-12-2006 04:40 AM
07-12-2006 04:53 AM
#include <iostream>Tomi
#include <fstream>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
using namespace std;
ofstream out("C:\log.txt", ios::app);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
out << "DLL_PROCESS_ATTACH" << endl;
break;
case DLL_THREAD_ATTACH:
out << "DLL_THREAD_ATTACH" << endl;
break;
case DLL_THREAD_DETACH:
out << "DLL_THREAD_DETACH" << endl;
break;
case DLL_PROCESS_DETACH:
out << "DLL_PROCESS_DETACH" << endl;
break;
}
return TRUE;
}
07-12-2006 05:04 AM
Hi there
though i'm not a fan of CIN you could consider to use them. a CIN provides the routines
CINRun
CINLoad
CINInit
CINAbort
CINSave
CINDispose
CINUnload
CINProperties.
because the CIN-code (*.lsb) is loaded into the VI it's harder to crack the license test.
07-12-2006 05:15 AM
hi there
i tested your code. DLL_PROCESS_ATTACH is called when i LOAD the VI containing the Call library node (LOAD, not run!).
07-12-2006 06:45 AM
#include <iostream>
#include <fstream>
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
using namespace std;
ofstream out("C:\log.txt", ios::app);
out.setf(ios::unitbuf);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
out << "DLL_PROCESS_ATTACH";
break;
case DLL_THREAD_ATTACH:
out << "DLL_THREAD_ATTACH";
break;
case DLL_THREAD_DETACH:
out << "DLL_THREAD_DETACH";
break;
case DLL_PROCESS_DETACH:
out << "DLL_PROCESS_DETACH";
break;
default :
out << "UNKNOWN_CALL: " << ul_reason_for_call;
}
out << " lpReserved=" << lpReserved << endl;
return TRUE;
}
07-12-2006 06:59 AM
hi there,
i get
Load VI to memory : DLL_PROCESS_ATTACH lpReserved=00000000
Remove VI from memory : DLL_PROCESS_DETACH lpReserved=00000000
i attached my vi and the dll sources (LV 6.0, MS VC++ 6.0)
07-12-2006 10:02 AM
07-12-2006 10:39 AM
07-12-2006 11:01 AM