@Sean Does it make sense these days to have the HAVE_CONFIG_H define in common.h? As far as I know we're not doing anything to make sure it works without defining that variable.
Anything defining the *_DLL_EXPORTS and *_DLL_IMPORTS defines will need it for sure at the moment, since the COMPILER_DLLEXPORT and COMPILER_DLLIMPORT definitions are coming from CMake. I could check that COMPILER_DLLEXPORT is defined and define out the *_EXPORT if it's not, but that would lead to working, silent skipping of the hidden visibility feature as well as complicating all the *_EXPORT blocks...
After thinking it through that's probably the best option though - it will keep default behavior for codes that don't use brlcad_config.h
Well, best for Linux anyway - Windows is still going to require HAVE_CONFIG_H, because without it they won't have the declspec definitions they need in the headers
We were more less accidentally stand-alone previously with every definition having the platform specific logic...
Looks like the options are require HAVE_CONFIG_H in client codes or go back to having the ifdef PLATFORM piece in common.h that sets COMPILER_DLL* values without the configure test.
Actually, they'll need both BRLCADBUILD and HAVE_CONFIG_H. Ugh.
Should we make a second generated header that's not specific to BRLCADBUILD?
@Sean Ugh. I know you don't like platform symbol tests Sean, but darned if I'm seeing a better solution to this one so far...
Conceptually, the config header is supposed to be a report out of the compiling-computer's configuration
So it shouldn't have the import/export logic in it as to an installed brl-cad, the config header shouldn't exist to them.
the typical way this is dealt with is compile-time definitions passed as flags
But how would the client code know it needs to define them in the first place?
API instructions for each lib typically if import isn't the default, but usually import is simply the default and then the local build has to define exports accordingly.
Did a problem crop up?
yes. client code attempted to build, but COMPILE_DLLIMPORT wasn't defined
I'm not seeing a reference to COMPILE_DLLIMPORT on trunk -- where is it?
I found it, common.h
typo
Sorry, COMPILER_DLLIMPORT.
Set in toplevel CMakeLists.txt line 1980, written to the brlcad_config.h header
The __declspec(dllimport) used to be hardcoded everywhere, so client codes didn't have to worry about it.
right, so yeah, should take it out of config. that belongs in common.h or down in each lib
I’d put it in common with some offed logic, like ifdef attribute
So really, brlcad_config.h shouldn't be installed at all? Or do we include it as a reference so we know how the libs were built?
it's for the latter. granted someone can set BRLCADBUILD and HAVE_CONFIG_H to try and use it, but that's on them and why they have to take extra steps.
Last updated: Jan 09 2025 at 00:46 UTC