- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone,
I'm again having trouble calling a fortran-dll from VB6:
Here is the function definition:
Here is the vb6 declaration:
Compiler Options are (IVF9)
I'm getting a runtime error #49, invalid calling convention.
Any ideas?
Thanks in advance
Felix Obermaier
I'm again having trouble calling a fortran-dll from VB6:
Here is the function definition:
logical(2) function CMaToV3Mat( cFile, pMat, iOF, iOT, iDF, iDT )
!DEC$ ATTRIBUTES DLLEXPORT, ALIAS:'CMaToV3Mat' :: CMaToV3Mat
!DEC$ ATTRIBUTES VALUE :: iOF, iOT, iDF, iDT
implicit none type (T_MATRIX), pointer :: pMat character(len = *) :: cFile integer(4) :: iOF, iOT, iDF, iDT end function
Here is the vb6 declaration:
Private Declare Function CMaToV3Mat _ Lib "C:VENUSivv3bV3V3ASSSimV3MatR.DLL" ( _ ByVal strFileName As String, ByRef hMatrix As Long, _ ByVal lngOrigFrom As Long, ByVal lngOrigTo As Long, _ ByVal lngDestFrom As Long, ByVal lngDestTo As Long, _ ByVal lngLenFilename As Long) As Boolean
Compiler Options are (IVF9)
/nologo /Zi /Od /GB /module:"$(INTDIR)/" /object:"$(INTDIR)/" /traceback /check:bounds /libs:dll /dbglibs /winapp /c /dll
I'm getting a runtime error #49, invalid calling convention.
Any ideas?
Thanks in advance
Felix Obermaier
Message Edited by fobermaier on 10-14-2005 10:03 AM
Message Edited by fobermaier on 10-14-2005 10:10 AM
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
AFAIK VB6 default for externals is __stdcall, but IVF default is __cdecl. So, a STDCALL attribute should sort it out.
Also, pay attention to pMat argument; since it's a pointer, in C terms, it matches a void** (T_MATRIX**), so on VB side its equivalent (actual argument) should be an address of an integer variable which holds address of a T_MATRIX (rather than mere address of a T_MATRIX). I don't know how to spell it in VB though.
Jugoslav
Also, pay attention to pMat argument; since it's a pointer, in C terms, it matches a void** (T_MATRIX**), so on VB side its equivalent (actual argument) should be an address of an integer variable which holds address of a T_MATRIX (rather than mere address of a T_MATRIX). I don't know how to spell it in VB though.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the hint, Jugoslav. I've added
Felix Obermaier
/iface:cvf /iface:nomixed_str_len_argto the command line options and now everything works fine.
Felix Obermaier

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page