fortran dlls

fortran dlls

I would like to find out if there is a way to create fortran dll that in turn will be called by VB 6.0. So far i have tried multiple different ways to accomplish this but it seems that i can not create a dll that will work just right. When the dll is called by Visual Basic 6.0 the following error message is displayed:

"Run Time Error 453"
Can't find DLL entry point _xadd@8 in .....

The fortran dll has one subroutine called xadd, which takes two parameters, both single in VB or real*4 in fortran and it outputs their result. I read numerous articles on this topic but had no luck so far. What am i doing wrong? Any ideas, comments or suggestions would be appreciated, thanks.

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Both linker and run-time binding are case-sensitive. By default, CVF uppercases names in exported symbols and .objs, while VB expects lowercase. So, you can fix it either by aliasing the export on CVF side:

!DEC$ATTRIBUTES DLLEXPORT, DECORATE, ALIAS: "xadd":: XAdd
or
!DEC$ATTRIBUTES DLLEXPORT, ALIAS: "_xadd@8":: XAdd
(on older CVF versions)

or import on VB side:

Declare Sub XAdd(...) Lib "MyDll.dll" Alias "_XADD@8"

DUMPBIN command-line tool which comes with CVF can tell you a lot about contents of libs, objs and dlls.

Jugoslav

Jugoslav www.xeffort.com

Thanks for the pointer. At this time let me show you what code i have:

In fortran i wrote the following function which i turned to xadd.dll:

function xadd(a,b)
!DEC$ATTRIBUTES DLLEXPORT,ALIAS: "_xadd@8":: Xadd
xadd=a+b
return
end

In my VB 6.0 module global for the test project i wrote the following:

Public Declare Function xadd Lib "c:dllsxadd.dll" Alias "_xadd@8" (ByRef a As Single, ByRef b As Single) As Single

I do not know what to do beyond this point. I do not get any more errors, but my value from the xadd.dll is not being passed to VB. Any ideas or am i doing anything wrong again, thanks

thanks i got it

Leave a Comment

Please sign in to add a comment. Not a member? Join today