Hi -
I am trying to write a simple test DLL in C++ for use in VB.
Unfortunately, when I try to access functions in the DLL, I get the error
"Can't find entry point square in SquareTest.dll". I have tried compiling
the DLL on different machines (in case there was a Visual C++ installation
problem), tried starting with both an empty Win32 DLL project, and with a
"simple" Win32 DLL project, and now I am lost.
Here is the code:
VB:
Private Declare Function square Lib "C:\Documents and
Settings\Administrator\My Documents\BootsWork\dllTest\squaretest.dll"
(ByVal x As Long) As Long
Private Sub btnCompute_Click()
txtOutput.Text = square(txtInput.Text)
End Sub
C++:
//squaretest.cpp
#include "stdafx.h"
#include "squaretest.h"
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID
lpReserved
)
{
return TRUE;
}
extern "C" double __stdcall square(double x) {
return x * x;
}
//squaretest.h
extern "C" double __stdcall square(double x);
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID
lpReserved
);
Thanks in advance for any help,
Adam