Software Archive
Read-only legacy content
17061 Discussions

Problem thunking to fortran DLL from legacy app.

Intel_C_Intel
Employee
474 Views
Greetings;

Currently we are stuck with a group of 16-bit legacy apps written in C/C++. We are using the generic thunk mechanism to call a Fortran DLL from one of these apps. At the time, this appears to work. We can load the DLL and call the exported functions.

However, we were having a lot of random crashes on our 95/98 machines and we traced the problem down to the loading of the Fortran DLL. All you have to do is load the Fortran DLL (never calling an exported function) using LoadLibraryEx32W( "name", NULL, 0 );

A test program that does nothing but make the above call (or the above call combined with the appropriate FreeLibrary32W call) will cause the computer to exhibit the following symptoms: Random crashes of the OS sometime thereafter (sometimes) or (always) you will be unable to shut down the OS correctly (it hangs during the shutdown process, never completing and wanting you to run scandisk upon the next startup).

Anyone ever seen this before?

Thanks,
Darrell
0 Kudos
1 Reply
Steven_L_Intel1
Employee
474 Views
I can't recall hearing of this problem before. Does the Dll have a DllMain entry point? (This is optional - if it is there, Windows calls it on loading the DLL.)

I'm unfamiliar with the "thunk" mechanism, though. The Visual Fortran run-time DLL probably DOES have a DllMain entry point, and it may be doing something that doesn't work in this "thunked" environment. Try, as an experiment, building your DLL with the Libraries setting changed from DLL to Static (or on the command line, use /libs:static), and see if that makes a difference.

Steve
0 Kudos
Reply