Greetings,
The following piece of code (F77.FOR and test.cpp) can work well using
VC++6.0 and VF6.0. Recently I changed VC++6.0 to VC++7.0 (Visual Studio.net
2003). Both files
can still be compiled successfully and linked together successfully in
VC++7.0. The executable is not able to run. The running exits with code 255
and cannot even enter
main. Can any one tell me how to fix this problem ??
C Fortran routine F77.FOR
C It is made as a static library in VF6.0.
subroutine F77(d1, d2)
double precision d1, d2
d2 = sqrt(d1)
return
end
// C++ routine, test.cpp
// It is compiled in VC++7.0 and linked with F77.lib
// Link can produce errors about multiple definitions
// of _matherr in both libc.lib and dfor.lib.
// But either using /FORCE:multiple or adding dfor.lib
// in front of other C libs in link options can
// get a successful link.
extern "C" {
void _stdcall F77(double *d1, double *d2);
}
#include <math.h>
int main()
{
double d1 = 100.0, d2;
d2 = sqrt(d1);
F77(&d1, &d2);
return 0;
}
Regards
Tony
===================================
This list is hosted by DevelopMentor� http://www.develop.com
Some .NET courses you may be interested in:
NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls
View archives and manage your subscription(s) at http://discuss.develop.com