Using a C++ Library in VB 
Author Message
 Using a C++ Library in VB

Hello People!

I really have a problem and hopefully one of you can help me!

A businesspartner of mine wrote a DLL in C++ which I want to use in my VB
application.
The name of the DLL is pin.dll and the concerned function is:

BOOL Check_Pin(char* ANI, char* Pin);

Oke, in VB I declare the function as follows:

Declare Function Check_Pin Lib "c:\_jorrit\pin\pin.dll" (ANI As String, Pin
As String) As Boolean

Then, when I try to call the function this way:

result = Check_Pin("86677213", "536645")

It gives the following error:

Error 453: Can't find DLL entry point Check_Pin in c:\_jorrit\pin\pin.dll

What can I do to fix this???

Thanks for your help!

Jorrit Steetskamp

The Netherlands



Mon, 23 Sep 2002 03:00:00 GMT  
 Using a C++ Library in VB
Did you try

Declare Function Check_Pin Lib "c:\_jorrit\pin\pin.dll" (ANI As String, Pin
 As String) As Integer

because the BOOL type of C++ is not a boolean, it is a long, isn't it (wich
is different from  bool )?

Bruno


Quote:

> Hello People!

> I really have a problem and hopefully one of you can help me!

> A businesspartner of mine wrote a DLL in C++ which I want to use in my VB
> application.
> The name of the DLL is pin.dll and the concerned function is:

> BOOL Check_Pin(char* ANI, char* Pin);

> Oke, in VB I declare the function as follows:

> Declare Function Check_Pin Lib "c:\_jorrit\pin\pin.dll" (ANI As String,
Pin
> As String) As Boolean

> Then, when I try to call the function this way:

> result = Check_Pin("86677213", "536645")

> It gives the following error:

> Error 453: Can't find DLL entry point Check_Pin in c:\_jorrit\pin\pin.dll

> What can I do to fix this???

> Thanks for your help!

> Jorrit Steetskamp

> The Netherlands



Mon, 23 Sep 2002 03:00:00 GMT  
 Using a C++ Library in VB
I tried a sample.
The result is that VB cannot call a dll with cdecl calling convention
I used the stdcall convention in the settings of the project, compiled the
dll.
Then using quickview to find out the name of the exported function (in c++
there is name mangling):

declare the function as follows:
Private Declare Function myTotoFunction Lib

(ByVal w As String) As Long

(the mangled name is after "Alias")

which worked for that prototype:
_cdecl(dllexport) int myTotoFunction(char* flap);

the vb call:

dim a as long
a= myTotoFunction ("word")

B.


Quote:

> Hello People!

> I really have a problem and hopefully one of you can help me!

> A businesspartner of mine wrote a DLL in C++ which I want to use in my VB
> application.
> The name of the DLL is pin.dll and the concerned function is:

> BOOL Check_Pin(char* ANI, char* Pin);

> Oke, in VB I declare the function as follows:

> Declare Function Check_Pin Lib "c:\_jorrit\pin\pin.dll" (ANI As String,
Pin
> As String) As Boolean

> Then, when I try to call the function this way:

> result = Check_Pin("86677213", "536645")

> It gives the following error:

> Error 453: Can't find DLL entry point Check_Pin in c:\_jorrit\pin\pin.dll

> What can I do to fix this???

> Thanks for your help!

> Jorrit Steetskamp

> The Netherlands



Tue, 24 Sep 2002 03:00:00 GMT  
 Using a C++ Library in VB

To make the C++ DLL work succesfully with VB, my partner had to change the
DLL:
- exporting the function with a .def file
- Using "_stdcall" before the function to export.

So we could work around the "cdecl problem".
I don't have any C++ experience myself, but this is what I understood.

Thanks to Bruno!

Cheers, Jorrit


Quote:
> I tried a sample.
> The result is that VB cannot call a dll with cdecl calling convention
> I used the stdcall convention in the settings of the project, compiled the
> dll.
> Then using quickview to find out the name of the exported function (in c++
> there is name mangling):

> declare the function as follows:
> Private Declare Function myTotoFunction Lib

> (ByVal w As String) As Long

> (the mangled name is after "Alias")

> which worked for that prototype:
> _cdecl(dllexport) int myTotoFunction(char* flap);

> the vb call:

> dim a as long
> a= myTotoFunction ("word")

> B.



> > Hello People!

> > I really have a problem and hopefully one of you can help me!

> > A businesspartner of mine wrote a DLL in C++ which I want to use in my
VB
> > application.
> > The name of the DLL is pin.dll and the concerned function is:

> > BOOL Check_Pin(char* ANI, char* Pin);

> > Oke, in VB I declare the function as follows:

> > Declare Function Check_Pin Lib "c:\_jorrit\pin\pin.dll" (ANI As String,
> Pin
> > As String) As Boolean

> > Then, when I try to call the function this way:

> > result = Check_Pin("86677213", "536645")

> > It gives the following error:

> > Error 453: Can't find DLL entry point Check_Pin in

c:\_jorrit\pin\pin.dll

- Show quoted text -

Quote:

> > What can I do to fix this???

> > Thanks for your help!

> > Jorrit Steetskamp

> > The Netherlands



Tue, 24 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Using a C++ Library in VB

2. Using a C++ Library in VB

3. Using a C/C++ static library from VB

4. Need help writing C++ DLL using BC45 and class libraries

5. DX8.1 Differences between VB and C++ libraries

6. C++ library in VB?

7. Using the MODELENGLib library (Microsoft Visio Database Modeling Engine Type Library)

8. Outlook 2003 C++ Runtime library error

9. Visual C++ Runtime Library Error

10. Microsoft Visual C++ Run time library Run time error R6025

11. Link with static C/C++ libraries?

12. Calling C++ Libraries

 

 
Powered by phpBB® Forum Software