Hi All,
I have created a simple DLL with Win32 Application Extension Wizard. I have a a couple of function that are to called from a VB project. Thus I have set the calling convension to __stdcall in the Project Settings. In VB I have used the following syntax:
Private Declare Function fTest Lib "<Path of Dll>" Alias "fnTest" () as Long
Private Sub Command1_Click()
Dim r as Long
r = fTest()
End Sub
I am receving a error message saying
Error: 453 Can't Find Dll Entry Point for fTest
I have also observed that it is DllMain call is successfull.
Please let me know what is problem in the code. The code is below:
Header File:
#ifdef TEST_EXPORTS
#define TEST_API __declspec(dllexport)
#else
#define TEST_API __declspec(dllimport)
#endif
#if defined(__cplusplus)
extern "C"{
#endif
TEST_API int fnTest(void);
#if defined(__cplusplus)
}
#endif
Implementation File:
#include "stdafx.h"
#include "test.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
MessageBox(NULL, "From Dll Main", "From Test Dll", MB_ICONASTERISK);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// This is an example of an exported function.
TEST_API int fnTest(void)
{
MessageBox(NULL, "Success!! Test Message", "From Test Dll", MB_ICONASTERISK);
return 42;
}
Thanks In Advance
regards
raochetan
I have created a simple DLL with Win32 Application Extension Wizard. I have a a couple of function that are to called from a VB project. Thus I have set the calling convension to __stdcall in the Project Settings. In VB I have used the following syntax:
Private Declare Function fTest Lib "<Path of Dll>" Alias "fnTest" () as Long
Private Sub Command1_Click()
Dim r as Long
r = fTest()
End Sub
I am receving a error message saying
Error: 453 Can't Find Dll Entry Point for fTest
I have also observed that it is DllMain call is successfull.
Please let me know what is problem in the code. The code is below:
Header File:
#ifdef TEST_EXPORTS
#define TEST_API __declspec(dllexport)
#else
#define TEST_API __declspec(dllimport)
#endif
#if defined(__cplusplus)
extern "C"{
#endif
TEST_API int fnTest(void);
#if defined(__cplusplus)
}
#endif
Implementation File:
#include "stdafx.h"
#include "test.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
MessageBox(NULL, "From Dll Main", "From Test Dll", MB_ICONASTERISK);
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
// This is an example of an exported function.
TEST_API int fnTest(void)
{
MessageBox(NULL, "Success!! Test Message", "From Test Dll", MB_ICONASTERISK);
return 42;
}
Thanks In Advance
regards
raochetan