this is an issue with pgf90 7.0-3 under WindowsXP together with gcc 3.4.4
I have a small C program that gets the MAC addresses on a machine, using GetAdaptersInfo() after #include <iphlpapi.h>, convert it to a string, and now I would like to pass it to a Fortran program.
The C function works fine, a simple Fortran program that calls that routine, compiled with g77 3.4.4, prints out the MAC address:
write(,*) 'MAC: ',mac
g77 -g -fno-second-underscore main.f get_info.o -liphlpapi -lnetapi32
But, when I use pgf90 instead of g77, there are several problems:
libiphlpapi.a and libnetapi32.a are not found, because pgf90 wants to have a *.lib file … annoying, but a simple cp *.a to *.lib helps
If my C program has a static array of predefined size like:
gcc uses __alloca from the glibc to put it on the stack.
If I link with pgf90, it complains about undefined reference to __alloca, and if I tell pgf90 to use /usr/lib/libc.a (or libc.lib after copying it, see above), I guess that I get a mixture of different glibc versions… and the link step fails.
Solution: if I use malloc() for ainfo, it works.
- Finally, I get an executable:
pgf90 -g -Mfree -Munix main.f get_info.o -liphlpapi -lnetapi32
but the resulting main.exe crashes before even entering the first line in the C function - and gdb has no idea where or why.
So I guess that the libiphlpapi.a and libnetapi32.a from /usr/lib of my cygwin are not usable with pgf90. Is there anything I can do to get a function that gives the MAC addresses of the installed devices using pgf90 and gcc?? Any idea why the Win32API libraries can not be used??