- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I understand, that a Fortran 95 program, when ending, gives up all its allocated memory to the system, so no deallocation is necessary and memory leaks cannot occur at that time.
Is this also true for Fortran DLL's called from, f.i., C# at returning to the calling program?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No - that cleanup doesn't happen until image exit. Returning from a procedure, whether it is in a DLL or static library, is not the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Erik,
I have Fortran routines in a DLL called from C#, and I use the "deallocate" command in the Fortran routines to make sure that all local arrays in the Fortran routines have been deallocated before exiting back to the C#. Deallocating the Fortran arrays allows changes in the C# GUI to the input values so that the Fortran routines can be called again. Is this what you want to do? I also avoid using the "stop" command in the Fortran DLL routines as that can freeze the program. I've found it is better to return an error message or flag from the Fortran DLL to the C# code.
Regards,
Greg T.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page