forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Linking .obj or. lib created by 64-bit MS/VC?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
qt



Joined: 23 Aug 2005
Posts: 46
Location: Berlin, Germany

PostPosted: Tue May 30, 2017 11:55 am    Post subject: Linking .obj or. lib created by 64-bit MS/VC? Reply with quote

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
View user's profile Send private message Visit poster's website
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Tue May 30, 2017 12:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Tue May 30, 2017 12:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
Ryan



Joined: 25 Feb 2016
Posts: 110

PostPosted: Tue May 30, 2017 12:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7912
Location: Salford, UK

PostPosted: Tue May 30, 2017 4:13 pm    Post subject: Reply with quote

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
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group