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 

Multiply defined symbols for INTEL build using clearwin64.dl

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



Joined: 03 Jun 2013
Posts: 279

PostPosted: Tue May 12, 2020 11:00 am    Post subject: Multiply defined symbols for INTEL build using clearwin64.dl Reply with quote

Hello,

I am building a GUI application using INTEL's 64 bit fortran compiler ifort, INTEL's linker xilink and SALFORD's Dll clearwin64.dll.

If I am using clearwin64.dll and clearwin64.lib of SALFORD ftn95 version 7.10 the building process works fine and creates the executable successfully.

However, if using clearwin64.dll and clearwin64.lib of SALFORD ftn95 version 8.61 (version info of clearwin64.dll in resource monitor: 22.2.3.15, date: 03.02.2020), then INTEL's linker xilink reports the following errors (and does not create the executable expected):
Code:

LIBCMT.lib(memcpy.obj) : error LNK2005: memmove already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(crt0dat.obj) : error LNK2005: exit already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(unlink.obj) : error LNK2005: remove already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(getenv.obj) : error LNK2005: getenv already defined in clearwin64.lib(clearwin64.dll)
LIBCMT.lib(atox.obj) : error LNK2005: atoi already defined in clearwin64.lib(clearwin64.dll)
..\p64_intel\p0918w.exe : fatal error LNK1169: one or more multiply defined symbols found

. I could force xilink to ignore this (via option "/FORCE:MULTIPLE") and thus I could create the executable in question (named p0918w.exe).
But I am unsure about possible side effects and hence would like to know more about the errors/warnings.
I used commmand
Code:

dumpbin /EXPORTS clearwin64.dll

to observe that e.g. symbol exit is exported by clearwin64.dll version 8.61, but not by clearwin64.dll version 7.10. I wonder why this is the case.

Please note: clearwin64.lib is the import library supplied by SALFORD and needed for the build process using INTEL's ifort. Moreover, all the module files (and corresponding objects) needed for building have not been suppied by SALFORD and have been built by me using ifort and the module sources supplied by SALFORD in directory
Code:

FTN95\source64

of the ftn95 installation in question ( i.e. version 7.10 or version 8.61).

LIBCMT.lib is a C Link Library used (mt stands for multithreaded) and I suspect that it is used because the GUI application is built from Fortran and C/C++ sources.

Any comment is welcome.

Regards,
Dietmar
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 12, 2020 12:44 pm    Post subject: Reply with quote

These C functions (including exit) are exported by the latest version of clearwin64.dll and have been included in recent versions but presumably not in the early version that you mention.

They were added for those who need these functions when combining 64 bit Silverfrost Fortran with 64 bit Silverfrost C/C++.

I don't know if there is any risk in using "/FORCE:MULTIPLE" and, at the moment I can't think of a work-around other than supplying a variant of clearwin64.dll that does not export these functions.
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Tue May 12, 2020 2:25 pm    Post subject: Reply with quote

Paul,

using "/FORCE:MULTIPLE" results in warnings
Code:

LIBCMT.lib(memcpy.obj) : warning LNK4006: memmove already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(crt0dat.obj) : warning LNK4006: exit already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(unlink.obj) : warning LNK4006: remove already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(getenv.obj) : warning LNK4006: getenv already defined in clearwin64.lib(clearwin64.dll); second definition ignored
LIBCMT.lib(atox.obj) : warning LNK4006: atoi already defined in clearwin64.lib(clearwin64.dll); second definition ignored
..\p64_intel\p0918w.exe : warning LNK4088: image being generated due to /FORCE option; image may not run

hence the symbols of clearwin64.dll are used and the symbols of ifort's libcmt.dll ignored.

For the moment I can live with option "/FORCE:MULTIPLE" but in the long term I would appreciate, if you could supply a variant of clearwin64.dll/clearwin64.lib that do not export these functions.

By the way: does this phenomenon occur for GNU Fortran, as well?

Thanks,
Dietmar
Back to top
View user's profile Send private message
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Fri Jul 17, 2020 2:33 pm    Post subject: Reply with quote

Paul,

one of my intel64 applications linked with clearwin64.dll of ftn95 version 8.63 crashes when calling
Code:
EXIT$


. Via dumpbin I see that it is still part of clearwin64.dll.
The same is true if I replace EXIT$ by EXIT.

Would it be possible to remove both symbols from clearwin64.dll?
Regards,
Dietmar
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Fri Jul 17, 2020 4:23 pm    Post subject: Reply with quote

Dietmar

EXIT$ and EXIT are native FTN95 intrinsics so I don't see how we can remove support for them.

These routines are subroutines that require a CALL and they both take a single integer argument.

Maybe you could replace the call to EXIT$ by STOP.
Back to top
View user's profile Send private message AIM Address
LitusSaxonicum



Joined: 23 Aug 2005
Posts: 2388
Location: Yateley, Hants, UK

PostPosted: Sat Jul 18, 2020 2:47 pm    Post subject: Reply with quote

Dietmar,

You could always ask Intel to change their compiler ....

Eddie
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Sun Jul 19, 2020 4:57 am    Post subject: Reply with quote

Dietmar,

Rather than mess with CLEARWIN64.DLL, you could produce your custom version of an import library for the DLL by (1) use DUMPBIN /exports on the DLL to produce a DEF file, (2) edit the DEF file and remove the symbols such as EXIT and EXIT$ that you do not want exported, and (3) use LIB.exe on the DEF file to generate your custom version of CLEARWIN64.a.

You then use your custom version of CLEARWIN64.a when linking your application with the INTEL RTL.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Jul 19, 2020 7:42 am    Post subject: Reply with quote

That is an interesting idea from mecej4. clearwin64.dll is built using Microsoft C/C++ and I could supply the .def file from which a custom .lib stub library could be produced.
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Mon Jul 20, 2020 10:42 am    Post subject: Reply with quote

Paul, mecej4,

this sounds good. I would appreciate if Paul could send me a def file (based on version 8.63 of ftn95 environent). I still do not understand if this def file will contain both the symols exit and exit$ or not and how I would create the corresponing lib file from this def file using utility lib.

Thanks and regards,
Dietmar
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Mon Jul 20, 2020 11:41 am    Post subject: Reply with quote

The procedure is quite simple.

    1. Obtain the DEF file from PaulLaidler and make a working copy, say DSCLRWIN.def. This a plain text file, with the first one or two lines naming the new library that will be built. Subsequent lines contain the names of entry points in CLEARWIN64.DLL, one entry per line. You are going to prune this list to suit your needs.

    2. Edit the DEF file working copy and remove the lines containing entries that you do not want to be visible to the MS linker when you link your Intel Fortran programs, such as EXIT$.

    3. Create the new import library (stub library) using the LIB utility (part of MS Visual C package, also used by Intel Fortran)
    Code:
    lib /def:dsclrwin.def /machine:amd64

Use the resulting dsclrwin.lib file instead of the one that you used in the past when linking with Intel Fortran (clearwin64.lib?).
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Jul 20, 2020 12:34 pm    Post subject: Reply with quote

Here is a link to the current .def file for ClearWin64.dll...

https://www.dropbox.com/s/whc3flqeakpihe4/omni.def?dl=0
Back to top
View user's profile Send private message AIM Address
DietmarSiepmann



Joined: 03 Jun 2013
Posts: 279

PostPosted: Mon Jul 20, 2020 2:28 pm    Post subject: Reply with quote

mecej4, Paul,

thanks for your instructions and the def file. This helped to remove the "exit doubly defined" warning. Unfortunately it does not prevent the runtime error. Hence I first will try to get rid of all other symbols which are doubly defined before attacking the runtime error occurring when calling exit.

Regards
Dietmar
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 1884

PostPosted: Mon Jul 20, 2020 2:43 pm    Post subject: Reply with quote

Dietmar,

Please keep in mind that non-standard functions such as EXIT$ may have different interfaces depending on whether they are provided by Silverfrost or Intel.

When you use such routines, you have to make sure that you are passing the correct types, order and values of arguments, and take appropriate actions depending on returned error codes.
Back to top
View user's profile Send private message
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