Re: Trouble linking FORTRAN DLL with C++ application (undefined reference)
From: Jugoslav Dujic (jdujicREMOVE_at_uns.ns.ac.yu)
Date: 01/28/04
- Next message: Arjen Markus: "Re: Help from fellow Fortran Users"
- Previous message: Arjen Markus: "Re: Fortran and C++ portability (was Re: Help from fellow Fortran Users)"
- In reply to: Steve Kramer: "Trouble linking FORTRAN DLL with C++ application (undefined reference)"
- Next in thread: Steve Kramer: "Re: Trouble linking FORTRAN DLL with C++ application (solution)"
- Reply: Steve Kramer: "Re: Trouble linking FORTRAN DLL with C++ application (solution)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 28 Jan 2004 09:48:05 +0100
Steve Kramer wrote:
| I created a FORTRAN DLL with Digital Visual Fortran 6.0 and have been
| able to access that DLL successfully from a calling application in
| FORTRAN.
|
| I'm now trying to call the same FORTRAN DLL from C++ and am having
| trouble with the getting the calling conventions right. I have
| reviewed some relevant articles in comp.lang.fortran and in the Intel
| developer forum, including these:
|
<snip>
| Based on those and other articles, here's how I set things up.
|
<snip>
| (b) I added the FORTRANINIT.lib file to the C++ project in Bloodshed
| Dev-C++ 4.0 (from www.bloodshed.net/devcpp.html) and compiled the
| calling C++ application.
|
| (c) There were no compilation errors, but there was a linker error:
|
| undefined reference to `_imp__FORTRANINIT@8'
|
| Any ideas as to what I'm missing here? I would like to be able to
| call the same FORTRAN DLL from FORTRAN and C++. I have tried
| omitting both the FORTRAN ALIAS as well as the __declspec(dllimport)
| in C++ without any luck.
It seems you followed a correct procedure... for linking with Visual C++.
I suspect the problem is that you're using Dev-C++, and I don't know
if it's link-compatible with MSVC++/CVF. Based on the info from web site
you provided, it seems not (it says that its compiler is Mingw port of
gcc).
You'd be probably better off asking this in a Devcpp/mingw/gcc specific
group. The issue is the same as how to call a dll written in VC++ from
that environment (as CVF .dlls and .libs are the same as VC++ looking
from outside).
-- Jugoslav ___________ www.geocities.com/jdujic
- Next message: Arjen Markus: "Re: Help from fellow Fortran Users"
- Previous message: Arjen Markus: "Re: Fortran and C++ portability (was Re: Help from fellow Fortran Users)"
- In reply to: Steve Kramer: "Trouble linking FORTRAN DLL with C++ application (undefined reference)"
- Next in thread: Steve Kramer: "Re: Trouble linking FORTRAN DLL with C++ application (solution)"
- Reply: Steve Kramer: "Re: Trouble linking FORTRAN DLL with C++ application (solution)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|