🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.basic.visual.misc
6 messages
6 total messages Started by Sylvain Souche Tue, 20 Feb 1996 17:21
DLL, VB and Borland C/C++
#148
Author: Sylvain Souche
Date: Tue, 20 Feb 1996 17:21
15 lines
833 bytes
Hi,

I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a 
VB 3.0 application, but VB always complains about a so called "Bad 
Calling Convention Error". This Error message is not very documented, 
and Borland Help files are worth nothing, so...

If anyone know about this problem, could you tell me.

Thanks for e-mail replies


-- 
        Sylvain Souche
	Sylvain.Souche@supaero.fr
Re: DLL, VB and Borland C/C++
#146
Author: Robert Taylor
Date: Wed, 21 Feb 1996 06:26
25 lines
1312 bytes
Sylvain Souche wrote:
> 
> Hi,
> 
> I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a
> VB 3.0 application, but VB always complains about a so called "Bad
> Calling Convention Error". This Error message is not very documented,
> and Borland Help files are worth nothing, so...
> 
> If anyone know about this problem, could you tell me.
> 
> Thanks for e-mail replies
> 
> --
>         Sylvain Souche
>         Sylvain.Souche@supaero.fr

You are probably not exporting the function correctly in the Borland C++ 
DLL.  I am pretty sure that VB 3.0 requires imported functions to be 
'FAR PASCAL'.  

If you are not declaring the function as FAR PASCAL, it will default to 
'CDECL'; which will cause the above mentioned error...

-- Bob T.
Re: DLL, VB and Borland C/C++
#147
Author: Jens Balchen Jr.
Date: Wed, 21 Feb 1996 16:14
19 lines
1047 bytes
Sylvain Souche <souche@supaero.fr> decided to share with us the infinite
reservoirs of wisdom:

>Hi,

>I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a 
>VB 3.0 application, but VB always complains about a so called "Bad 
>Calling Convention Error". This Error message is not very documented, 
>and Borland Help files are worth nothing, so...

post the dll's code (or at least the part that goes MyFunc(....)) and the
VB declaration you're using.

Jens (balchen@sn.no)
-- 
Newbiehood is not a period of time, it's a way of life.

http://www.sn.no/~balchen
ftp://ftp.sn.no/user/balchen/
Re: DLL, VB and Borland C/C++
#153
Author: Jeff Jenkins
Date: Thu, 22 Feb 1996 19:17
31 lines
1483 bytes
Robert Taylor wrote:
> 
> Sylvain Souche wrote:
> >
> > Hi,
> >
> > I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a
> > VB 3.0 application, but VB always complains about a so called "Bad
> > Calling Convention Error". This Error message is not very documented,
> > and Borland Help files are worth nothing, so...
> >
> > If anyone know about this problem, could you tell me.
> >
> > Thanks for e-mail replies
> >
> > --
> >         Sylvain Souche
> >         Sylvain.Souche@supaero.fr
> 
> You are probably not exporting the function correctly in the Borland C++
> DLL.  I am pretty sure that VB 3.0 requires imported functions to be
> 'FAR PASCAL'.
> 
> If you are not declaring the function as FAR PASCAL, it will default to
> 'CDECL'; which will cause the above mentioned error...
> 
> -- Bob T.

Also, make sure you don't have exception handling enabled for the DLL.

-- jrj
Re: DLL, VB and Borland C/C++
#172
Author: Michel Lombart
Date: Sat, 02 Mar 1996 22:09
15 lines
903 bytes
Sylvain Souche <souche@supaero.fr> wrote

>Hi,

>I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a 
>VB 3.0 application, but VB always complains about a so called "Bad 
>Calling Convention Error". This Error message is not very documented, 
>and Borland Help files are worth nothing, so...

 Hi Sylvain.

Did you use, if necessary,  the "byval" option in your declaration
code?

Michel
Re: DLL, VB and Borland C/C++
#175
Author: Nick Primavesi
Date: Mon, 25 Mar 1996 09:52
37 lines
1537 bytes
tlgnsmd@mail.interpac.be (Michel Lombart) wrote:

>Sylvain Souche <souche@supaero.fr> wrote

>>Hi,

>>I am trying desperatly to call a DLL created with Borland C/C++ 4.5 in a 
>>VB 3.0 application, but VB always complains about a so called "Bad 
>>Calling Convention Error". This Error message is not very documented, 
>>and Borland Help files are worth nothing, so...

> Hi Sylvain.

>Did you use, if necessary,  the "byval" option in your declaration
>code?

>Michel

I have the same problem with VB4.0 and Visual C++ DLLs

The ByVal option is required but this does not always cure the
problem.

VB uses the PASCAL calling convention so the DLL should be compiled
using FAR PASCAL for 16 bit or __stdcall. This still did not cure my
problem but it got me closer.

I have just been infomed that my problem is due to the omission of the
.DEF file by the VC++ compiler now so check that you also have the
DEF file with the .DLL.

Let me know if this helps and if you discover anything that may help
me.

Cheers,

Jolyon.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads