Hello CLN list, and a Happy New Year,
* Richard B. Kreckel wrote on Mon, Dec 17, 2007 at 09:09:21AM CET:
I don't see how your patch can work. With -fPIC, we'll have to write _GLOBAL__I_foo.cc, alright, but without -fPIC, we'll have to stick to _GLOBAL__I_func. Your patch defines the macro CL_GLOBAL_CONSTRUCTOR_SUFFIX(module) but does not distinguish between these two cases. So, if you ./configure --enable-shared --enable-static, as is the default, either the shared or the static library will not work. Somehow, we must distinguish between the two cases, and I don't see how it can be done without some #if defined(PIC) sections.
Hmm. I don't know how to fix this well: module.h gets installed and used by third-party software (users of CLN). It needs to provide different settings for whether the user will later use the static or the shared version of libcln. This is ugly, because it's generally not known at compile time which library will be used. Unless libcln limits itself to installing just one version of the library, I don't see how this can be solved without requiring that the user of libcln choose at compile time (by a suitable define) whether to use the static or shared library (which is a different question whether the user is currently building PIC or non-PIC code). Cheers, Ralf