Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017 Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
<== Date ==> <== Thread ==>

Subject: RE: epicsExport.h on Windows
From: Mark Rivers <rivers@cars.uchicago.edu>
To: Ralph Lange <ralph.lange@gmx.de>, EPICS Core Talk <core-talk@aps.anl.gov>
Date: Tue, 21 Mar 2017 13:21:11 +0000
Hi Ralph,

I just tested removing the extern "C" from NDArrayPool.cpp and it compiles OK but fails when linking simDetector.

make[5]: Entering directory 'J:/epics/devel/areaDetector-2-6/ADSimDetector/iocs/simDetectorIOC/simDetectorApp/src/O.windows-x64-static'
link -nologo   -incremental:no -opt:ref -release  /MACHINE:X64              -out:simDetectorApp.exe        simDetectorApp_registerRecordDeviceDriver.obj simDetectorAppMain.obj
../../../../../lib/windows-x64-static/simDetector.lib  J:/epics/devel/areaDetector-2-6/ADCore/lib/windows-x64-static/ADBase.lib  J:/epics/devel/areaDetector-2-6/ADCore/lib/windows-
x64-static/NDPlugin.lib  J:/epics/devel/areaDetector-2-6/ADCore/lib/windows-x64-static/ntndArrayConverter.lib  H:/epics-devel/epicsV4/EPICS-CPP-4.6.0/normativeTypesCPP/lib/windows-
x64-static/nt.lib  H:/epics-devel/epicsV4/EPICS-CPP-4.6.0/pvDatabaseCPP/lib/windows-x64-static/pvDatabase.lib  H:/epics-devel/epicsV4/EPICS-CPP-4.6.0/pvAccessCPP/lib/windows-x64-st
atic/pvAccess.lib  H:/epics-devel/epicsV4/EPICS-CPP-4.6.0/pvDataCPP/lib/windows-x64-static/pvData.lib  J:/epics/devel/areaDetector-2-6/ADCore/lib/windows-x64-static/ntndArrayConver
ter.lib  J:/epics/devel/areaDetector-2-6/ADSupport/lib/windows-x64-static/netCDF.lib  J:/epics/devel/areaDetector-2-6/ADSupport/lib/windows-x64-static/tiff.lib  J:/epics/devel/area
Detector-2-6/ADSupport/lib/windows-x64-static/jpeg.lib  J:/epics/devel/areaDetector-2-6/ADSupport/lib/windows-x64-static/xml2.lib  J:/epics/devel/areaDetector-2-6/ADSupport/lib/win
dows-x64-static/NeXus.lib  J:/epics/devel/areaDetector-2-6/ADSupport/lib/windows-x64-static/hdf5.lib  J:/epics/devel/areaDetector-2-6/ADSupport/lib/windows-x64-static/szip.lib  J:/
epics/devel/areaDetector-2-6/ADSupport/lib/windows-x64-static/zlib.lib  J:/epics/devel/asyn-4-31/lib/windows-x64-static/asyn.lib  J:/epics/devel/autosave-5-7-1/lib/windows-x64-stat
ic/autosave.lib  J:/epics/devel/busy-1-6-1/lib/windows-x64-static/busy.lib  J:/epics/devel/calc-3-6-1/lib/windows-x64-static/calc.lib  J:/epics/devel/devIocStats-3-1-14/lib/windows
-x64-static/devIocStats.lib  J:/epics/devel/sscan-2-10-2/lib/windows-x64-static/sscan.lib  J:/epics/devel/seq-2-2-4/lib/windows-x64-static/seq.lib  J:/epics/devel/seq-2-2-4/lib/win
dows-x64-static/pv.lib  H:/epics-devel/base-3.15.5/lib/windows-x64-static/dbRecStd.lib  H:/epics-devel/base-3.15.5/lib/windows-x64-static/dbCore.lib  H:/epics-devel/base-3.15.5/lib
/windows-x64-static/ca.lib  H:/epics-devel/base-3.15.5/lib/windows-x64-static/Com.lib gdi32.lib oleaut32.lib psapi.lib ws2_32.lib advapi32.lib user32.lib kernel32.lib winmm.lib

   Creating library simDetectorApp.lib and object simDetectorApp.exp
NDPlugin.lib(NDFileHDF5LayoutXML.obj) : warning LNK4217: locally defined symbol xmlFree imported in function "private: int __cdecl hdf5::LayoutXML::parse_root(void)" (?parse_root@LayoutXML@hdf5@@AEAAHXZ)
simDetectorApp_registerRecordDeviceDriver.obj : error LNK2019: unresolved external symbol pvar_int_eraseNDAttributes referenced in function "void __cdecl `dynamic initializer for 'vardefs''(void)" (??__Evardefs@@YAXXZ)
simDetectorApp.exe : fatal error LNK1120: 1 unresolved externals
H:/epics-devel/base-3.15.5/configure/RULES_BUILD:201: recipe for target 'simDetectorApp.exe' failed
make[5]: *** [simDetectorApp.exe] Error 1120
make[5]: Leaving directory 'J:/epics/devel/areaDetector-2-6/ADSimDetector/iocs/simDetectorIOC/simDetectorApp/src/O.windows-x64-static'
H:/epics-devel/base-3.15.5/configure/RULES_ARCHS:58: recipe for target 'install.windows-x64-static' failed
make[4]: *** [install.windows-x64-static] Error 2
make[4]: Leaving directory 'J:/epics/devel/areaDetector-2-6/ADSimDetector/iocs/simDetectorIOC/simDetectorApp/src'
H:/epics-devel/base-3.15.5/configure/RULES_DIRS:84: recipe for target 'src.install' failed
make[3]: *** [src.install] Error 2
make[3]: Leaving directory 'J:/epics/devel/areaDetector-2-6/ADSimDetector/iocs/simDetectorIOC/simDetectorApp'
H:/epics-devel/base-3.15.5/configure/RULES_DIRS:84: recipe for target 'simDetectorApp.install' failed
make[2]: *** [simDetectorApp.install] Error 2
make[2]: Leaving directory 'J:/epics/devel/areaDetector-2-6/ADSimDetector/iocs/simDetectorIOC'
H:/epics-devel/base-3.15.5/configure/RULES_DIRS:84: recipe for target 'simDetectorIOC.install' failed
make[1]: *** [simDetectorIOC.install] Error 2
make[1]: Leaving directory 'J:/epics/devel/areaDetector-2-6/ADSimDetector/iocs'
H:/epics-devel/base-3.15.5/configure/RULES_DIRS:84: recipe for target 'iocs.install' failed
make: *** [iocs.install] Error 2

So it appears the extern "C" is required on Windows.  It links fine on Linux without extern "C".

Mark



________________________________
From: Mark Rivers
Sent: Tuesday, March 21, 2017 7:31 AM
To: Ralph Lange; EPICS Core Talk
Subject: RE: epicsExport.h on Windows

Hi Ralph,

I don't use epicsExportAddress very much.  But I just did a search of all of synApps, including areaDetector, and found this:

corvette:~/devel>find . -name '*.cpp' -exec grep -H epicsExportAddress {} \;
./areaDetector-2-6/ADCore/ADApp/ADSrc/NDArrayPool.cpp:extern "C" {epicsExportAddress(int, eraseNDAttributes);}
./motor-6-9/motorApp/NPointSrc/C300MotorDriver.cpp:extern "C" {epicsExportAddress(int, C300Tolerance);}
./motor-6-9/motorApp/OmsAsynSrc/omsMAXv.cpp:extern "C" {epicsExportAddress(int, motorMAXvdebug);}
./motor-6-9/motorApp/OmsAsynSrc/omsMAXvEncFunc.cpp:extern "C" {epicsExportAddress(int, motorMAXvEncFuncdebug);}
./motor-6-9/motorApp/OmsAsynSrc/omsMAXnet.cpp:extern "C" {epicsExportAddress(int, motorMAXnetdebug);}
./motor-6-9/motorApp/OmsAsynSrc/omsBaseController.cpp:extern "C" {epicsExportAddress(int, motorOMSBASEdebug);}

So all instances are indeed wrapped in extern "C".

A search of base 3.14.12.5, 3.15.5, and EPICS V4 4.6.0 finds no occurrences of epicsExportAddress in .cpp files.

Mark


________________________________
From: core-talk-bounces@aps.anl.gov [core-talk-bounces@aps.anl.gov] on behalf of Ralph Lange [ralph.lange@gmx.de]
Sent: Tuesday, March 21, 2017 7:16 AM
To: EPICS Core Talk
Subject: epicsExport.h on Windows

Dear Core-Talkers,

For a device support partly written in C++, we have been getting a pull request for Windows builds that adds extern "C" declarations around EPICS exports, e.g.

-epicsExportAddress(double, connectInterval);
+extern "C" {
+    epicsExportAddress(double, connectInterval);
+}

with the comment

I am afraid that the extern statements in epicsExport.h are ignored by VS compiler when expanding the epicsRegisterFunction macro. Therefore they need to be repeated here otherwise we get a linking failure when building test IOC.

As my Windows experience is very limited - is there a better way to handle that?

Thanks,
~Ralph


References:
epicsExport.h on Windows Ralph Lange
RE: epicsExport.h on Windows Mark Rivers

Navigate by Date:
Prev: Re: epicsExport.h on Windows Michael Davidsaver
Next: RE: epicsExport.h on Windows Mark Rivers
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
Navigate by Thread:
Prev: RE: epicsExport.h on Windows Mark Rivers
Next: Re: epicsExport.h on Windows Michael Davidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <2017
ANJ, 21 Mar 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·