This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
g77 commo block with mixed code
- From: Mangesh M Kale <M dot Kale at soton dot ac dot uk>
- To: binutils at sources dot redhat dot com
- Date: Fri, 24 Jan 2003 15:54:30 +0000
- Subject: g77 commo block with mixed code
I am using some fortran routines as libraries (as dlls) in my main c
programme.
the set up is as: winXP+minGw + gcc g77 3.2.1
fortran file qld.f:
SUBROUTINE QL0001(....)
..
..
REAL EPS
COMMON /CMACHE/EPS
...
..
END
in my C code I need to access EPS and assign a value to it before
calling QL0001
the C code is main_t.c
....
/*extern struct
{ double eps; try1
} cmache;*/
/*extern double *cmache; */ try2
extern double cmache; // try3
__declspec(dllimport) void ql0001(....);
main()
{
....
/*cmache.eps=2.2204e-16;
*cmache =2.2204e-16; */
cmache =2.2204e-16;
....
ql0001(....).;
}
the copilation is as:
g77 -shared -fPIC -ff77 -w -fno-underscoring -O3 -malign-double
-ffast-math -funroll-all-loops \ -fno-f2c -Bdynamic -mcpu=pentium
-fno-exceptions qldx.f -o qldx.dll \
-Wl,--dll,--output-def,qldx_out.def,--out-implib,libqldx.lib
gcc -o main_t.exe main_t.c -L./ -lqldx
linking is successful and I do get a main_t.exe.
...
in all the three attempts I tried above, my main.exe is getting
terminated when eps variable is assigned.
the call to ql0001 is working fine as I have tested it without eps
assignment and handcoding it in fortran code. but I need to do it in C
code .
is there any way this problem can be sorted out ?
apologies if I have missed something above
many thanks
mangesh