- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just finished a task that inluded linking a CVF-created DLL to a Lahey Fortran executable. During the process and after reading LF and CVF documentation on using DLL's I ended up with the following question(s):
Both compilers' documentations suggest that the import library created during the compilation of DLL should beincluded during thecompilation ofa consoleexecutable that uses the DLL. I tested this withCVF. Sure enough, if theDLL's import library is not included in the executable's project you end up with a linker error. On the other hand, Lahey didn't complain about not having the import library; referencing the DLL during the compilation of the console executable was enough. Similarly with Visual Basic one doesn't need the import library when linking the VB code against a Fortran DLL. So, my questions are, what is the the cause of this difference between two different programming languages and between two compilers for the same language? Why can one Fortran compiler (LF) link against a DLL without its import library (even if it is explained otherwise in its documentation) when the other one (CVF) can't? And ultimately, what are the mechanics of linking a console executable against a DLL (i.e. what information is stored in the .dll and .lib files and how is this informationutilized during linking)
I appreciate any clarifications on this.
John
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
without the .lib file, your application has to find the dll, load the dll, search the dll for a function corresponding to the one you want - all at run-time.
with the .lib file, your compiler will have a pretty good idea of what the dll looks like, before run-time. this has the advantage that if you try to call a function whatever(), the linker will tell you whether or not you're doing it correctly. if you're not calling it correctly, your app fails at link time. if you don't use a lib file, and you're not doing the function call correctly, then your app fails at runtime.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! This makes sense. Are the .lib files universal or compiler dependent? I mean, will LF read the .lib file created by CVF and vise versa? And can Visual Basic read the .lib file CVF generates (I don't know if this is even an option for VB, though)?
John

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page