[Proj] proj and geotrans global variables

Roger Oberholtzer roger at opq.se
Thu Jan 12 04:20:46 EST 2006


I have had a need to make a statically linked application on Linux.
Granted this is a one-off as we usually only use dynamic linking. But I
have encountered a problem:

The application should have the library from geotrans and from proj.
When statically linking such an app, it turns out that a bit of code
sharing between the two libraries has gotten in the way. The file in
question is geocent.c. It seems that this file in proj is originally
from geotrans. (Sorry if it is the other way around - my Sherlock Holms
abilities come and go.) The names of functions were modified; however,
the names of a few global variables were not changed. Specifically
Geocent_ep2, Geocent_e2 and Geocent_a. So, the GNU linker refuses to
statically link a program with these two libraries as these variables
are multiply defined.

When looking at both libraries, it appears that the values in question
are not used outside the geocent.c file. So, maybe they should be static
instead of global? Unless I miss a reference. Global variables in a
library is usually bad practice anyway.

-- 
Roger Oberholtzer
OPQ Systems AB




More information about the Proj mailing list