For Programmers: Free Programming Magazines  


Home > Archive > Fortran > July 2006 > g95 produced dll-file is corrupt









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author g95 produced dll-file is corrupt
robert@oeffner.net

2006-07-21, 8:00 am

Hi,
I'm trying to compile a large F95 project which has been distributed
over more OS's. As I'm working on a Windows XP PC I'm using the g95
compiler with Mingwin and the shell provided by MSYS for running the
makefile. The exectutable it produces appears to be working fine. So
far so good.
My task however, is to compile the code into a dll-file exporting some
functions that can be called from a client program. To that end I am
using the dllwrap and dlltool programs also provided by GNU.
Furthermore I have replaced the main fortran program routine with a
function. Next I link all compiled object files with the dllwrap
program as to produce the dll-file. The dll file, myfortran.dll, comes
out OK and I can inspect the names of exported functions and
subroutines in microsofts depends.exe program. Unfortunately trying to
load the dll in my client program by calling
HINSTANCE hinst = LoadLibrary("myfortran.dll")
yields the error ERROR_BAD_EXE_FORMAT. Other F95 projects I'm compiling
into dll files works fine. It has to be said that the project I'm
working on here is a large one with about 2Mb source files. Somewhere
on a newsgroup it was suggested that the dllwrap program might be
having problems with code alignment or so and that I could use a
compiler option or similar to circumvent this problem. If anyone has
any suggestions I'd be very grateful.

Rob

dpb

2006-07-21, 7:01 pm


robert@oeffner.net wrote:
....

> ...to compile the code into a dll-file ... I am
> using the dllwrap and dlltool programs also provided by GNU.

....
> ... trying to load the dll in my client program by calling
> HINSTANCE hinst = LoadLibrary("myfortran.dll")
> yields the error ERROR_BAD_EXE_FORMAT. Other F95 projects I'm compiling
> into dll files works fine. It has to be said that the project I'm
> working on here is a large one with about 2Mb source files. Somewhere
> on a newsgroup it was suggested that the dllwrap program might be
> having problems with code alignment or so and that I could use a
> compiler option or similar to circumvent this problem. If anyone has
> any suggestions I'd be very grateful.


I have absolutely no clue re: the toolset, but if it were something
about the size of the generated object file, that could be tested by
the bisection technique to see if the problem goes away w/ smaller
size. If so, then there's still the possiblity that there's a problem
somewhere in the remaining code so building two or more dll's of
smaller size and testing could also shed some light on whether it is
filesize related or not...

Other than that, it'll take someone other than me, sorry...

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com