By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,992 Members | 1,325 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,992 IT Pros & Developers. It's quick & easy.

Linking vs8 c++ to FORTRAN static library

P: 1
Dear Madam or Sir,


I encountered one problem which is quite similiar to the discussions launched at the web site:



http://www.thescripts.com/forum/thread280324.html


I am starting to compile a software for engineering calculation which is developed using MSVC v7.0 but now updating to MSVC v8.0. At the same time, the compiler we used is also updated to Intel 9.1. I encountered several problems:

Problem: Linking vs8 c++ to FORTRAN static library (using IDE Intel 9.1):

- FORTRAN 77 file as dll or static library: It works well with the .lib + .dll (compiled using an old Intel FORTRAN compiler) under the old win32 version. Now we want to use the code for x64. But we have problems to build up 64-bit .lib and .dll file using Intel 9.1 compiler. However, we encountered problem during linking C++ code with the FORTRAN library.

- So I go one step back to build the 32 -bit .lib and .dll using the new Intel 9.1 compiler. OK for compiling, but to my surprise, it won’t work when linking with the same C-code! No working.

- So I tried using static library instead, but remains the same problem as following:

- If I check the .lib file, there were two derived names for each exported functions, for example: _ZBIRY@32 and _ZBIRY@28. (The related command for that was !DEC$ ATTRIBUTES DLLEXPORT :: ZBIRY added to the FORTRAN code). But no such extension @32 or @28 were found in lib file generated using the new Intel compiler. If I additionally add !DEC$ ATTRIBUTES ALIAS:’_ZBIRY@32’ :: ZBIRY the error remains only ‘cannot find _ZBIRY@28’.

- If I add line !DEC$ ATTRIBUTES ALIAS:’_ZBIRY@32 _ZBIRY@28’ :: ZBIRY,

OR !DEC$ ATTRIBUTES ALIAS:’_ZBIRY@32 /_ZBIRY@28’ :: ZBIRY, in both case not working.



I added a smple test project to show the problems (I can send the project file if one could help) (Email xieml2007@hotmail.com).

Would you please help me?

Thanks a lot in advance for your kind help!



M. Xie

// F2CLink.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

// windows
extern "C" void _stdcall ZBIRY(double* ZR,
double* ZI,
int* ID,
int* KODE,
double* BIR,
double* BII,
int* IERR);
extern "C" void _stdcall ZAIRY(double* ZR,
double* ZI,
int* ID,
int* KODE,
double* AIR,
double* AII,
int* NZ,
int* IERR);

int _tmain(int argc, _TCHAR* argv[])
{
double fr = 0.0;
double fi = 0.0;
int nz = 0;
int ierr = 0;
int id = 0;
int kode = 2;
double argr = 1.0;
double argi = 2.0;

ZAIRY(&argr, &argi, &id, &kode, &fr, &fi, &nz, &ierr);
return 0;
}

Current error:

1>------ Build started: Project: F2CLink, Configuration: Release Win32 ------
1>Linking...
1>ZairyZbiry.lib(ZairyZbiry.obj) : warning LNK4229: invalid directive '/_ZBIRY@28' encountered; ignored
1>LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
1>Build log was saved at "file://c:\SWDev\nSights\F2CLink\F2CLink\F2CLink\Release\B uildLog.htm"
1>F2CLink - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
May 11 '07 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.