PDA

View Full Version : Re: [LF] linking FORTRAN object to MS DevStudio C++ code


Lahey Support
08-15-2003, 01:33 AM
> Bill,
>
> The subroutine in this example should appear in an ML_EXTERNAL
> statement. The ML_EXTERNAL and DLL_EXPORT statements make routine names
> eligible for "decoration" using the "-ml xxxx" compiler switch. If the
> routine name does not appear in one of these statements, the "-ml msvc"
> switch at compile time will have no effect. If your subroutine does not
> use any intrinsic fortran routines, this is probably all that is needed.
> If the subroutine does use intrinsics, you will also need to link the
> appropriate runtime library.
>

I added

ml_external foobar

after

SUBROUTINE foobar(var)

and recompiled. I added

extern "C" void __stdcall FOOBAR( int var );

to the header file. This is now the error I get.

Linking...
foo.obj : error LNK2001: unresolved external symbol _jwe_xcop
testView.obj : error LNK2001: unresolved external symbol [address removed]
Release/test.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

If I leave off the 'extern "C"' it doesn't help much. I get nearly the
same errors. As you might imagine, this is very frustrating!

This is a test program I am working on. I am not calling any FORTRAN
libraries (yet).

Bill Tangren

----------------------------------------------------------
To unsubscribe, send to [address removed] the following
as the first and only line of the message body:
unsubscribe fortran
----------------------------------------------------------