PDA

View Full Version : Unmanaged Fortran Code (Not MSIL)


micromuni
12-29-2003, 05:29 PM
Unmanaged Code in Lahey Fortran and Intel Fortran 7.0


I tried to create an unmanaged Fortran DLL which generated the
appropriate export
dll_export :: MySub
line for exporting the entry point of the Dll.

My Visual Basic program still could not find the entry point for this routine.

If I created the same code in Intel's Fortran 7.0, with the export line as

!DEC$ ATTRIBUTES DLLEXPORT :: MySub

I get the same error message as the Lahey Fortran

However, if I utilize the following two lines instead:

!DEC$ ATTRIBUTES DLLEXPORT :: MySub
!DEC$ ATTRIBUTES ALIAS:'MySub' :: MySub

then Visual Basic.Net can find and utilize the unmanaged code.

Any comments about the Lahey Fortran and unmanaged code would be greatly appreciated.

tzeis
12-29-2003, 08:39 PM
There is an additional piece to the puzzle, besides the DLL_EXPORT statement. You also need to select the appropriate calling convention, which is "Lahey/Fujitsu Fortran 95" by default. If you look at the property pages for the source file, you will see a "Mixed Language" page. Here you should change the mixed language target from "Lahey/Fujitsu Fortran 95" to "Microsoft Visual Basic", and your VB program should be able to find the entry point.