I want to write some very simple functions, pack them into a DLL and call them from Excel (VB using DECLARE Function....). I have used VC application wizard to generate a Windows 32 DLL + exported that includes an exported function that does nothing more than return the integer 42. I have selected explicit linking. (I don't need MFC or automation)
Visual Basic reports an Error to the effect that it cannot find an entry point for the DLL. - I have used Show Dep(endencies) to view the exported functions - no problem here although I note that function DLLMain does not appear in the list of exports. What am I doing wrong ? - Why does Microsoft bother producing wizards that generate unuseable code?
Do I need to register the DLL before I can use it ?
DLLMain is defined by the wizard as doing nothing other than returning true Eg:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
Visual Basic reports an Error to the effect that it cannot find an entry point for the DLL. - I have used Show Dep(endencies) to view the exported functions - no problem here although I note that function DLLMain does not appear in the list of exports. What am I doing wrong ? - Why does Microsoft bother producing wizards that generate unuseable code?
Do I need to register the DLL before I can use it ?
DLLMain is defined by the wizard as doing nothing other than returning true Eg:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}