View previous topic :: View next topic |
Author |
Message |
qt
Joined: 23 Aug 2005 Posts: 46 Location: Berlin, Germany
|
Posted: Tue May 30, 2017 11:55 am Post subject: Linking .obj or. lib created by 64-bit MS/VC? |
|
|
Hello!
A customer asks, if it is possible to link static objects or libraries (.obj, .lib) created by 64-bit MS/Visual C?
Does SLINK64 process VC 64-bit objs and libs?
Does someone has a simple example which shows what to obey (on both sides, VC and FTN95/64)?
As always, thanks to all who take care.
Kind regards
Joerg Kuthe
QT software |
|
Back to top |
|
|
mecej4
Joined: 31 Oct 2006 Posts: 1886
|
Posted: Tue May 30, 2017 12:46 pm Post subject: |
|
|
The 64-bit OBJ files produced by FTN95 are not compatible with 64-bit OBJ and LIB files produced by VC and MS Link/Lib.
FTN95 comes with a C compiler, SCC, which supports /64. The resulting OBJ file can be linked with SLINK64, but not with MS Link. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Tue May 30, 2017 12:57 pm Post subject: |
|
|
I've been working with a similar issue for a couple of months now and here is what I have found. I may be doing something wrong in which case I'm happy to hear of another approach.
The object files output by the Microsoft C compiler (CL) can have duplicate section names in them. This is something that slink (32 bit) does not like at all and it exits with an error. I can't remember if the 64 bit Slink64 does the same but we need both 32 and 64 bit builds which consume external C++ libraries which means we can't use slink.
What we have tried to do now is use the Microsoft Linker (Link) to link the C++ object files to those object files output by ftn95. This works up to a point, the object files generated by ftn95 do not have their functions available as exports (this is normally done by slink, but we are unable to use it) so the Fortran code cannot be seen by the C++ code. But the C++ code can be called by the Fortran code. This may work for you.
To get your C++ libraries linkable, you may have to exclude a lot of conflicting compiler generated code such as stack probes / checks, security cookies and turn off all access to the standard C libraries as they conflict with the Salford library functions (printf for example).
I'm investigating whether I can merge the object files generated by FTN95 with slink / slink64 and export everything in a standard COFF2 format link file now. If so, this should help us finish out 64 bit port. |
|
Back to top |
|
|
Ryan
Joined: 25 Feb 2016 Posts: 110
|
Posted: Tue May 30, 2017 12:59 pm Post subject: |
|
|
In response to mecej4, I find the SCC compiler crashes with 64 bit compilations and is not stable. Which is why we are using the Microsoft one for the C++ aspect. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7928 Location: Salford, UK
|
Posted: Tue May 30, 2017 4:13 pm Post subject: |
|
|
You can create a DLL using Microsoft C++. Export all your functions using extern "C" and then use a load instruction in SLINK64 to load the DLL (not a stub library nor a static library). |
|
Back to top |
|
|
|