Experimental Physics and Industrial Control System
On 1/27/21 3:01 AM, Ralph Lange via Core-talk wrote:
> Question about developing on Windows:
>
> How do you manage unit testing of internal classes in DLLs?
>
> Internal classes (that are not DLL exported) are by design not visible through the DLL interface, which means linking a unit test against the DLL won't allow it to access the internal APIs it is supposed to test.
> (No such problem on Linux where all functions inside the shared library are visible.)
>
> I know I can work around by linking the needed objects directly into the test executable. Is there any preferable or better solution?
I'm in the habit of marking these sorts of symbols for export.
In my mind dllexport does not imply a public API. eg. about half
of the symbols exported by libca.so are only used by libdbCore.so
(for local CA).
On 1/27/21 3:57 AM, Mark Rivers via Core-talk wrote:
...
> That is true by default, but GCC >= 4 has __attribute__ ((visibility ("hidden"))) which will also hide classes on Linux.
>
> This article makes the argument for why it is a good idea to use it:
>
> https://gcc.gnu.org/wiki/Visibility
I keep the following in configure/CONFIG_SITE.local
USR_CFLAGS_Linux += -fvisibility=hidden
USR_CXXFLAGS_Linux += -fvisibility=hidden -fvisibility-inlines-hidden
Mostly this helps me find dllimport/export problems earlier, though
there is also some slight reduction in linking/loading time.
(I'll take what I can get wrt. c++ build times)
- Replies:
- RE: Unit tests on Windows DLL internals Akeroyd, Freddie (STFC, RAL, ISIS) via Core-talk
- References:
- Unit tests on Windows DLL internals Ralph Lange via Core-talk
- Navigate by Date:
- Prev:
Re: Unit tests on Windows DLL internals Mark Rivers via Core-talk
- Next:
Jenkins build is back to normal : EPICS-3.15 #264 Jenkins EPICS PSI via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: Unit tests on Windows DLL internals Mark Rivers via Core-talk
- Next:
RE: Unit tests on Windows DLL internals Akeroyd, Freddie (STFC, RAL, ISIS) via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024