- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The main program uses modules that are built in a DLL. One of the DLL procedures opens a log file. I'd like to be able to write to the log file from the main program. I can make the file unit number known to the main program via !DEC$ ATTRIBUTES DLLEXPORT, but of course that doesn't do anything for me - lines written to unit number 11 just go to fort.11. Is there a simple way to do what I want to do?
Thanks
Gib
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes - make sure that your main program links against the DLL form of the Intel run-time libraries. This has been the default in Visual Studio for several releases now, but an older project may not have it. (Your DLL must also link to the DLL libraries.) The project property for this is Fortran > Libraries > Use Runtime Library > Multithread DLL. Make sure that both your DLL and the main program have the same setting here.
What's happening is that your main program and your DLL each have their own copy of the run-time library, so they don't talk to each other.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I changed the main program project property from Multithread to Multithread DLL, but when I run the program I get this error:
Runtime Error!
R6034
An application has made an attempt to load the C runtime library incorrectly.
Maybe my compiler version (11.0.075) is too old for this to work. I know, you'll say my compiler is obsolete, but it works fine for my purposes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1) Make sure your DLL project has the same setting. Don't mix debug and non-debug.
2) If you have any OTHER projects (C/C++, for example) in the application, make sure that their setting for runtime libraries also matches.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve, both the DLL and the main project are Release, both use Multithread DLL, and there are no other projects in the application. Only Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error you saw occurs when there is a mixture of C library types. Make sure that you are activating the correct DLL.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I checked that the correct DLL is linked. Dependency Walker doesn't show anything odd, as far as I can tell. Both the DLL and the exe use c:\windows\system32\MSVCRT.DLL. Are there other libraries I should look for?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But are you running against the correct DLL? If so, then I have no other suggestions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Copying the DLL into the directory where I execute the program at the command line doesn't help.
Thanks for trying to help. It isn't a big deal anyway.
Cheers, Gib
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page