[GRASSLIST:1372] Re: cygwin 5.7 - db_driver_execute_immediate
Glynn Clements
glynn.clements at virgin.net
Sat Sep 27 22:16:16 EDT 2003
Markus Neteler wrote:
> > Thanks Markus, I updated from CVS and now get the error:
> > multiple definition of `_db_driver_execute_immediate'
>
> Exactly this (only) error I get when compiling on Mac OSX statically.
> Dirty solution:
>
> go to lib/db/stubs/execute.c and rename the function to something else.
> Then it compiles.
>
> Clean solution:
> find it! Why does only this function cause problems but no others
> in stubs?
My guess is that the problem occurs when a driver provides its own
version of db_driver_execute_immediate(), but doesn't provide either
db_driver_begin_transaction() or db_driver_commit_transaction() (i.e.
the other two functions in lib/db/stubs/execute.c).
If I'm correct (you don't specify exactly which directories are
failing to compile), the DBF, MySQL and ODBC drivers will fail, while
the PostgreSQL driver should succeed.
A static library (.a) is just an "archive" of object (.o) files,
similar to a .zip or .tar file. When linking against a .a file, the
linker only uses the .o files which are actually needed (i.e. that
export one or more symbols which would otherwise be undefined).
If a driver provides its own version of all three of the functions
from lib/db/stubs/execute.c, the linker won't need to the execute.o
file from libgrass_dbstubs.a, so it won't include it in the link.
Similarly, if a driver provided none of the three functions, the
linker would include the execute.o file from libgrass_dbstubs.a, but
there wouldn't be any conflicts.
OTOH, if the driver provides db_driver_execute_immediate() but not the
other two, the linker will include the execute.o file from
libgrass_dbstubs.a, resulting in two conflicting versions of
db_driver_execute_immediate().
The simplest solutions would be to either:
1. Split lib/db/stubs/execute.c into two separate files, moving the
transaction functions into a separate file (presumably these functions
will always form a matched pair, i.e. a driver will either implement
both or implement neither).
2. Remove the stubs library altogether, and make each driver have its
own copy of any stub functions.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list