Code Comments
Programming Forum and web based access to our favorite programming groups.Hi!
I want to call a Fortran Routine from a C++ - program, so I compiled
the fortran part with the fortran compiler (Compaq Visual Fortran) and
appended it to my c++ project (using Microsoft Visual Studio 6.0).
in the c++ program I declared the Fortran routine as following:
extern "C" { void _stdcall
electro1_(int* ,float* ,float* ,bool* ,float* );}
and my call is
electro1_(&hoehe,actual_column_t,actual_column_p,&erster_Aufruf,actual_colum
=
n_xNe);
in the fortran file, the subroutine is defined as
subroutine ELECTRO1 (Nrhox,T,Pgas,if_ndens,xNe)
and it just doesn=B4t work,
I get the errors
error LNK2001: unresolved external symbol _electro1_@20
Debug/tp500.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
any ideas?
thx for all pieces of advice,
Iso
Post Follow-up to this messageOn 3 apr, 12:27, Isomorphismus <natalieh...@hotmail.com> wrote:
> Hi!
> I want to call a Fortran Routine from a C++ - program, so I compiled
> the fortran part with the fortran compiler (Compaq Visual Fortran) and
> appended it to my c++ project (using Microsoft Visual Studio 6.0).
>
> in the c++ program I declared the Fortran routine as following:
>
> extern "C" { void _stdcall
> electro1_(int* ,float* ,float* ,bool* ,float* );}
>
> and my call is
>
> electro1_(&hoehe,actual_column_t,actual_column_p,&erster_Aufruf,actual_col=[/color
]
u=ADmn_xNe);
>
> in the fortran file, the subroutine is defined as
>
> subroutine ELECTRO1 (Nrhox,T,Pgas,if_ndens,xNe)
>
> and it just doesn=B4t work,
> I get the errors
> error LNK2001: unresolved external symbol _electro1_@20
> Debug/tp500.exe : fatal error LNK1120: 1 unresolved externals
> Error executing link.exe.
>
> any ideas?
> thx for all pieces of advice,
> Iso
Yes, a couple:
- You use _stdcall, that is probably the same as __stdcall,
but that is what I use (double underscore).
- The name of the Fortran routine is _ELECTRO1_@20 (after
application of all decorations). So on the C++ side
the name should be ELECTRO1_
- C++'s bool type is not the same as Fortran's logical type.
You will need to convert the values properly.
But the all-uppercase name for Fortran routines is the one
causing the current failure.
Regards,
Arjen
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.