Subject: name-space protect symbols

From: [email-masked]
Date: Mon, 20 Dec 2004 06:21:58 -0500

Hi All,

Much appreciative of all the work to date that's been put into the c-client. 
Have used it for years with php.  As of late have run into a problem and now
i'm running around the internet to try and get it sorted.  It has to do with
php and how it compiles in mysql 4.1 libraries and c-client libraries.

http://bugs.php.net/bug.php?id=31182

/usr/local/imap-2004a/lib/libc-client.a(misc.o)(.text+0x8a4): In
function `hash_reset':
/build/imap-2004a/c-client/misc.c:278: multiple definition of
`hash_reset'
/usr/lib/mysql/libmysqlclient.a(hash.o)(.text+0x130): first defined
here
/usr/bin/ld: Warning: size of symbol `hash_reset' changed from 94 in
/usr/lib/mysql/libmysqlclient.a(hash.o) to 89 in
/usr/lib/mysql/libmysqlclient.a(hash.o)
collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

The folks on the php side of things have indicated that perhaps folks who
develop both mysql and/or c-client should name-space protect their symbols. 
Was wondering if this is something that's already done with c-client code.  If
not, how difficult would it be to affect this change?

Anyways, any feedback/messages, etc would be great.
Much appreciated!
-sd

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------

---

From: Mark Crispin <[email-masked]>
Date: Mon, 20 Dec 2004 09:14:07 -0800 (PST)

It seems that mysql and c-client have a global routine (that is, exported 
to the application) called hash_reset().  It isn't particularly surprising 
to find that two packages both use hash tables and have a routine to 
reset a hash table.

This is a classic case of what happens when two independent libraries 
happen to use the same name for a global routine.  I doubt that there was 
ever any thought in the development of mysql to link it with c-client in 
the same application; there was certainly not any such thought in the 
development of c-client.

I'm not sure what is meant by "name-space protect"; this may either refer 
to a C++ concept (c-client is written in C, not C++) or simply to the 
practice of assigning names that aren't likely to conflict (and renaming 
names that do conflict).

Renaming c-client function names is not out of the question; however, 
since it will cause an interface change (and possibly break applications) 
it is something that is done only after careful consideration *and* 
negotiation with the developers of the conflicting library.

Put another way: there never was any effort taken to make c-client and 
mysql link together in an application, and I'm surprised that there seems 
to be only one conflict.  I'm willing to undertake such an effort, but it 
has to be mutual on the part of the mysql developers (because it entails a 
long-term commitment on both sides).

So I guess that the best thing for you is to get in touch with the mysql 
developers, see what they say, and if they seem agreeable then put us all 
in touch with each other.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.

---

From: [email-masked]
Date: Tue, 21 Dec 2004 04:09:30 -0500

Hi Mark.

Thanks for the reply.  I've created a bug report with the mysql folks aswell.

http://bugs.mysql.com/bug.php?id=7428

I would be inclined it's something better suited for them to fix on their end as
earlier versions of mysql 4.1.x worked when being linked with c-client.  When I
sent this I wanted to ensure i've chased up on both ends.

Best Regards-

Quoting Mark Crispin <[email-masked]>: