DLL problems

A

Adam Glauser

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
 
A

Adam Glauser

Adam Glauser said:
I am trying to write a simple test DLL in C++ for use in VB.
[...]

Please don't post this to comp.lang.c++. It's off-topic there
regardless of your cross-posting or setting follow-ups. How
to make a DLL so that VB could use it is beyond the scope of
Standard C++ language, the subject of comp.lang.c++. You might
want to post this to comp.os.ms-windows.programmer or to the NG
for the C++ compiler you're using (microsoft.public.vc.language).

Thank you.

Victor

My apologies. I was not aware that this was off-topic. I am a bit new at
to the Usenet world, and simply assumed from the group name that any C++
related question was ok. I appreciate the gentle guidance, as opposed to
the chastisement that others may opt for, assuming that everyone knows
better. Thank you also for the suggestions of alternative groups to try.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top