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  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: registerRecordDeviceDriver.obj unresolved external symbols
From: "Johnson, Andrew N. via Tech-talk" <[email protected]>
To: "[email protected]" <[email protected]>
Date: Thu, 23 May 2019 18:41:55 +0000
Hi Patrick,

On 5/23/19 9:51 AM, Thomas, Patrick via Tech-talk wrote:

I think the attached is a minimum working example. Compiling it gives the following:

<snip>

link -nologo  -LTCG -incremental:no -opt:ref -release  -MACHINE:X64              -out:ads.exe        ads_registerRecordDeviceDriver.obj adsMain.obj     ..\\..\\..\\lib\\windows-x64\\adsSupport.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\recIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\softDevIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\miscIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\rsrvIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\dbtoolsIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\asIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\dbIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\registryIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\dbStaticIoc.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\ca.lib  C:\\Users\\patrick.thomas\\Desktop\\epics\\base-3.14.12.8\\lib\\windows-x64\\Com.lib
ads_registerRecordDeviceDriver.obj : error LNK2001: unresolved external symbol __imp_pvar_dset_bi_DevSet
ads_registerRecordDeviceDriver.obj : error LNK2001: unresolved external symbol __imp_pvar_func_devADSRegistrar
ads.exe : fatal error LNK1120: 2 unresolved externals

Okay, looking at your devADS.cpp file, firstly the epicsExport.h header should only be included after all the other EPICS Base headers you include. For static builds the order doesn't really matter, but it definitely will if you're building or linking to DLLs, so best keep it in the right place — it actually marks the boundary between headers for external libraries, and those for routines that will appear in the same DLL as the objects compiled from this file.

Mark Rivers was correct about the need for an extern "C" { ... } wrapper, which must appear around the epicsExportAddress() statements and any other epicsExport* statements you include in a C++ source. That change is sufficient for me to be able to build your example — the routines and data structures themselves don't have to be marked as extern "C".

The second error above is there because you still have a registrar entry for devADSRegistrar in the adsSupport.dbd file.

HTH,

- Andrew
-- 
Complexity comes for free, Simplicity you have to work for.

References:
registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk
Re: registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk

Navigate by Date:
Prev: Re: registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk
Next: UDP Warnings (VME and Linux) - Subnet wide Sullivan, Joseph via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: registerRecordDeviceDriver.obj unresolved external symbols Thomas, Patrick via Tech-talk
Next: Scanivalve DTS units Evans, Richard K. (GRC-H000) via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 24 May 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·