Error 49 -- Bad DLL Calling Convention 
Author Message
 Error 49 -- Bad DLL Calling Convention

I am using VB 6 and am writing a .dll for it using MSVC 6.
Unfortunely, I have run across a problem in getting my .dll
working properly with Visual Basic.  I keep getting a error 49 --
Bad .dll calling convention.  I've been working on this all day
yesterday and today but without success so any assistance would
be greatly appreciated.

I have declared my function in my C code as :

#ifdef __PLATFORM_MICROSOFT__
# define FuncType _stdcall
# ifdef __PLATFORM_WINDOWS_DLL__
#  define WinStuff __declspec(dllexport)
# endif
#endif

extern "C" {
// (ObjectManagerT here is a void *)
WinStuff ObjectManagerT FuncType ixCreateObjectManager(ULongT Passcode1,
ULongT Passcode2, StatusCodeT *Status);

Quote:
}

In VB I have declared it as:

Declare Function ixCreateObjectManager Lib "MyDLL.dll" (ByVal Passcode1 As
Long, ByVal Passcode2 As Long, ByRef Status As Long) As Long

I have also tried adding the "Alias" clause to it as:

Alias "_ixCreateObjectManager" and


Alias __ixCreateObjectManager and
several others I suspect.

Each time I run my test program I get an error # 49 -- Bad DLL Calling
Convention. However, as you can see, I am declaring it as
_stdcall (or __stdcall).  I have also tried using an exports file that

I have tried running it outside the VB IDE and no error message pops up.
However, when I do it from within the VB IDE, I get the error message.

This all looks like pretty straight forward stuff (or should be) and I've
been pounding on this most of yesterday and today without making
any progress.  Any assistance would be greatly appreciated.
(BTW: I am not super familiar with VB but I can get around in a
wide variety of environments when I need to.  So any extra pointers
would be greatly appreciated too.)

Thanks,

-Art
Art Pollard



Tue, 10 Aug 2004 06:09:25 GMT  
 Error 49 -- Bad DLL Calling Convention
The free eval version of TweakVB includes some example code of C functions
callable by VB. The examples illustrate the name mangling aspects of
directly compiling and linking C code into a VB project, but it might help
you out a little.

Check out www.TweakVB.com

Quote:
> I am using VB 6 and am writing a .dll for it using MSVC 6.
> Unfortunely, I have run across a problem in getting my .dll
> working properly with Visual Basic.  I keep getting a error 49 --
> Bad .dll calling convention.  I've been working on this all day
> yesterday and today but without success so any assistance would
> be greatly appreciated.



Tue, 10 Aug 2004 12:39:21 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Error 49: Bad Dll Calling convention

2. Help Re: error 49 Bad DLL calling convention

3. error 49 - bad dll calling convention

4. Run-time error '49': Bad DLL calling convention

5. Bad DLL calling convention (error 49)

6. Bad Calling Convention error 49 - due to calling a Sub in a .bas module

7. Possible answer to Err 49: Bad DLL calling convention

8. Possible answer to Err 49: Bad DLL calling convention

9. RunTime 49: Bad DLL Calling Convention

10. error 49 - Bad DLL callling convention

11. Help! Bad DLL Convention(49)

12. Access200 - Error 49: "Bad DLL calling..."

 

 
Powered by phpBB® Forum Software