- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everyone.
I have a fortran static library which I need to call from C++. I added the library to the C++ project and when I run the programI get this:
error LNK2019: símbolo externo Coresolver sin resolver al que se hace referencia en la función main.
This is my code:
extern "C"{ void Coresolver (int *Puntosnp, int *PuntosKr, double *Sw, double *Kro, double *Krw, double *Vp, double *Npcalc, double *DeltaPcalc); } int main() { int Puntosnp = 2; int PuntosKr = 2; double Sw[2]; double Krw[2]; double Kro[2]; double Vp[2]; double Npcalc[2]; double DeltaPcalc[2]; Sw[0] = 0.2, Sw[1] = 0.8; Krw[0] = 0.0, Krw[1] = 0.8; Kro[0] = 0.8, Kro[1] = 0.0; Vp[0] = 0.2, Vp[1] = 1.0; Npcalc[0] = 0.0, Npcalc[1] = 0.0; DeltaPcalc[0] = 0.0, DeltaPcalc[1] = 0.0; Coresolver(&Puntosnp, &PuntosKr, Sw, Kro, Krw, Vp, Npcalc, DeltaPcalc); return 0; }
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The names of Fortran external symbols are subject to "decoration", i.e., changing of case and adding an underscore as a prefix, depending on whether the code is for a 32-bit CPU or a 64-bit CPU. If you did not use the ISO-C interoperability features or the "legacy" directives when you built the Fortran library, the C name should be "CORESOLVER" for 64-bit and "_CORESOLVER" for 32-bit. For details, see the Intel Fortran documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
Thnaks, that worked. But I´m having other problem, Npcalc and DeltaPcalc are arrays and when I call CORESOLVER they should change their values but they remain in value cero.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You will have to show the Fortran source code of CORESOLVER (or at least the parts of it that set Npcalc and DeltaPcalc) in order for us to see what could have happened.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page