> Make sure this is in an extern "C" block.
>
[quoted text clipped - 111 lines]
> > 'Set up global declarations and declare functions.
> > Declare Function fnWin32DLL Lib
Turns out this is a VB6 bug where you must run the application from an EXE
(File/Make EXE) otherwise you will get the following error:
Run-time error: '49' Bad DLL calling convention
> Yes, I have looked using Dependency Walker V2.1 and the exported function
> "fnWin32DLL" is there. What should my extern declarations look like in the
[quoted text clipped - 133 lines]
> > > txtInputVarA.Text = x
> > > End Sub
Ronald Laeremans [MSFT] - 18 Nov 2003 19:44 GMT
Thanks for the follow-up.
Ronald
> Turns out this is a VB6 bug where you must run the application from an EXE
> (File/Make EXE) otherwise you will get the following error:
[quoted text clipped - 124 lines]
> > > > 'Set up global declarations and declare functions.
> > > > Declare Function fnWin32DLL Lib
"C:\jhoggood\Applications\CommonC\BuildFiles\Win32DLL\Debug\Win32DLL.dll"
> > > > (ByVal varIn As Integer) As Integer
> > > >
[quoted text clipped - 9 lines]
> > > > txtInputVarA.Text = x
> > > > End Sub
Mattias Sj?gren - 18 Nov 2003 21:40 GMT
Joe,
>Turns out this is a VB6 bug where you must run the application from an EXE
>(File/Make EXE) otherwise you will get the following error:
>
>Run-time error: '49' Bad DLL calling convention
This is not a bug, it's just a limitation in VB6. It only supports the
stdcall calling convention, so you must use that for your exported
functions if you want to call them from VB.
The reason you only see the runtime error in the IDE is that the
checks that have to be done to dicover the calling convention mismatch
are not performed in a compiled executable for performance reasons. It
does not mean that you can ignore the error you get.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.