- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I built twoDLLs in Compaq Visual Fortran. The first DLL opensa file (e.g., open unit=12, file='out.txt') and writes several lines of text to it. The file out.txt is infact created and contains the correct output. The first DLL then calls the second DLL whichalso writes to unit 12.Instead of writing to out.txt as I would like,it creates/writes to a file named fort.12. Is there a way to ensure that when eachDLL writes tounit 12 they are writing to the same file (out.txt)?
Thanks in advance
Jean
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think that the two DLLs are automatically aware of the files that each of them has open for I/O. Your second DLL may have to execute the same OPEN statement as the first one. Perhaps you could pass the logical unit number from the first to the second.
Mike D.
Mike D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to make sure that both DLLs are linked to the DLL form of the Fortran run-time libraries. (/libs:dll if you're using the command line.) Then it will work as you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve. I did verify that I was usingthe Fortran run-time libraries. Turns out that I had two problems: 1) mixing single- and multi-threaded DLLs, and 2) MCLS. Iwasbuilding the two DLLs separately - which seemed like the thing to do - and then have the first DLL use the second DLL. The problem was thateach DLLwas linked to the sameC library.In mycase, I wasableto combinethe two DLLs into one and now all of the output is written to the same file.
Jean
![](/skins/images/3344F5B3B76C91485ED0E980FD0CA95E/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page