EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Failed to create single DLLs on Windows
From: "Wang Xiaoqiang" <[email protected]>
To: "epics" <[email protected]>
Date: Thu, 7 May 2009 16:56:07 +0200
 

Hi,

Probably this is not interesting to anybody, but I made a temporary fix.

First I am wrong by saying it cannot link on win32-x86 because MS link
can 
handle this kind of self-reference. Here is the discussion exactly about
this,
http://blogs.msdn.com/oldnewthing/archive/2006/07/26/679044.aspx

So the problem is only about GNU linker. Although it cannot handle
self-reference,
it supports auto-import feature. In short, it does not require
__declspec(dllimport)
to import symbols from DLLs.
http://sourceware.org/binutils/docs-2.18/ld/WIN32.html

To make both happy, in shareLib.h I avoid the definition epicsShareXXX
for cygwin
Line 129
#       if defined(_DLL) && !defined(__CYGWIN32__)/* this indicates that
we are being compiled to call DLLs */
And then in configure/os/CONFIG.cygwin-x86.cygwin-x86 add
--enable-auto-import linker flag 
Line 23
SHRLIB_LDFLAGS = -shared
-Wl,--enable-auto-import,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX)
LOADABLE_SHRLIB_LDFLAGS = -shared
-Wl,--enable-auto-import,--out-implib,$(LIB_PREFIX)$*$(LIB_SUFFIX)

This may also apply to win32-x86-mingw, but I did not try.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Wang Xiaoqiang
Sent: Wednesday, May 06, 2009 2:12 PM
To: epics
Subject: Failed to create single DLLs on Windows



Hi,

On windows, with cygwin-x86 and win32-x86 host arch, I have compiled
EPICS base to create shared libraries.

Then I setup a simple application to create a DLL, and it complains
undefined reference (error output below).
I understand that this is because epicsShareExtern is defined as
__declspec(dllimport).
Linker is instructed to call these functions in some DLLs which is not
true, since I also compiled these functions in.
On the other hand, it builds successfully using the Makefile.support,
which separates the actual functions to a DLL, to satisfy the linker.
That looks a bit awkward. 

Because of my limited knowledge, I would ask gurus, are there other
solutions to such a pecular situation. Actually asyn/testManager example
has a similar problem, which wants to creat a single EXE.

Thanks in advance.


==== here starts the make output for cygwin-x86 === make -C O.cygwin-x86
-f ../Makefile TOP=../../.. T_A=cygwin-x86 install
make[1]: Entering directory `/w/test/epicsdum/dumApp/src/O.cygwin-x86'
g++ -o dum.dll -shared -Wl,--out-implib,dum.lib
-L/usr/local/epics/base/lib/cygwin-x86
dum_registerRecordDeviceDriver.o dumHello.o    -lrecIoc -lsoftDevIoc
-lmiscIoc -lrsrvIoc -ldbtoolsIoc -lasIoc -ldbIoc -lregistryIoc
-ldbStaticIoc -lca -lCom  -lpthread   -lreadline -lcurses -lm
dum_registerRecordDeviceDriver.o:dum_registerRecordDeviceDriver.cpp:(.te
xt+0x7): undefined reference to `__imp__pvar_func_helloRegister'
dum_registerRecordDeviceDriver.o:dum_registerRecordDeviceDriver.cpp:(.te
xt+0x37): undefined reference to `__imp__pvar_func_helloRegister'
dum_registerRecordDeviceDriver.o:dum_registerRecordDeviceDriver.cpp:(.te
xt+0x58): undefined reference to `__imp__pvar_int_helloVariable'
Creating library file: dum.lib
collect2: ld returned 1 exit status
make[1]: *** [dum.dll] Error 1
make[1]: Leaving directory `/w/test/epicsdum/dumApp/src/O.cygwin-x86'


--
Dr. Xiaoqiang Wang
Paul Scherrer Institut, WBGB/010
5232 Villigen PSI, Switzerland


References:
Failed to create single DLLs on Windows Wang Xiaoqiang

Navigate by Date:
Prev: Re: Motor Control - anyone have drivers and opinions for: SpiiPlus, Delta Tau, Parker ACR9000 Joe Sullivan
Next: DIfficulty with Libusb with EPICS Mehta, Pratik
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Failed to create single DLLs on Windows Wang Xiaoqiang
Next: Motor Control - anyone have drivers and opinions for: SpiiPlus, Delta Tau, Parker ACR9000 Dalesio, Leo
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  <20092010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 31 Jan 2014 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·