- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm attempting to link a static Fortran libray into a .dll to produce a shared library to be run by a third party product. Win2000, VF 6.6, VS 6.5+SP4.
I get an error:
dfor.lib(DFORMAIN.OBJ) : error LNK2001: unresolved external symbol _MAIN__
which completely baffles me as I don't have a MAIN declared within any of either the Fortran that makes up the static library I'm using, nor the C source files that make up the .dll I'm producing.
I tried adding an ignore library switch to my build for the dfor.lib but then my .dll won't execute and I don't even rate a useful error as to why it won't load/execute.
Any help would be appreciated.
I get an error:
dfor.lib(DFORMAIN.OBJ) : error LNK2001: unresolved external symbol _MAIN__
which completely baffles me as I don't have a MAIN declared within any of either the Fortran that makes up the static library I'm using, nor the C source files that make up the .dll I'm producing.
I tried adding an ignore library switch to my build for the dfor.lib but then my .dll won't execute and I don't even rate a useful error as to why it won't load/execute.
Any help would be appreciated.
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Something is referencing the symbol _main - but if your C code is using MFC, you may not see this directly. A link map would be helpful.
If you can't resolve this, please send a ZIP file of a project that demonstrates the problem to vf-support@compaq.com and we'll be glad to take a look.
Steve
If you can't resolve this, please send a ZIP file of a project that demonstrates the problem to vf-support@compaq.com and we'll be glad to take a look.
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I clicked the checkbox in project->settings->link->debug for a mapfile and I get a zero length file. I doubt sending that anywhere would do me any good.
Any other suggestions on what I can do?
Any other suggestions on what I can do?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What is the setting for Project..Settings..Fortran..Libraries..Use Run-Time Libraries, and the C++..Code Generation..Libraries?
You can check the "Force" option in the Linker tab to force the DLL to be built, but I realize that the map may not help.
Can you search your .lib and .obj files for _main and see what turns up?
Steve
You can check the "Force" option in the Linker tab to force the DLL to be built, but I realize that the map may not help.
Can you search your .lib and .obj files for _main and see what turns up?
Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Steve, the hint to look at the project settings led me to a number of different runtime library settings between the C/C++ and Fortran and the library vs project I was in. Once I set them all to be threaded dll I was golden.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Glad to hear it.
Steve
Steve

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