Subject: Problem with function name net_open

From: Mark Musone <[email-masked]>
Date: Wed, 9 Sep 1998 11:04:56 -0400 (EDT)

Hi,

I maintain the imap library for PHP (www.php.net), a server-side  web scripting language.
The imap module uses WU's c-client library.

Today we received a bug report that, when somebody compiles in the sybase-ct libraries,
theres a linking problem:

/opt/imap/lib/c-client.a(mail.o): In function `net_close':
mail.o(.text+0x9069): multiple definition of `net_close'
/opt/sybase/lib/libsybtcl.a(net_clos.o)(.text+0x0): first defined here
collect2: ld returned 1 exit status

It seems the sybase-ct library has the same function defined. The other problem is that the sybase
library does not come with source code.

Considering that net_close (and the other net_ functions) are documented API's, it doesnt seem 
as though it'd ever be considered to change the names (although it'd be great!)

The other thought i had was to maybe do something like
#ifdef PHP
#define net_close wu_imap_net_close

I'd even be happy to code this and submit the patches..

Any other suggestions would be greatly appreciated!!

Thanks,

Mark Musone
[email-masked]

------------------------------------------------------------------
 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: Wed, 9 Sep 1998 08:48:00 -0700 (PDT)

I'd prefer not to get into the business of site-dependent patches (although
that may be your best choice!); and you're right, it is a documented API
function so greater trauma would be caused by changing it in the distribution
version.

My feeling is that name conflicts between libraries are inevitable.  I once
had someone absolutely adamantly demand that I change the name of mail_open()
because he was using some library that had that name.

The ideal solution would be some sort of linker option that would permit
resolving conflicting globals, and/or localizing them to certain modules in
the link.  That doesn't imply that I know of any UNIX linker that does that
(but it seems to be a rather obvious function for an advanced linker).

-- Mark --

PS: By the way, we are the University of Washington (UW).  Washington
University (WU) is the name of three separate institutions in St. Louis, MO;
Bryn Mawr, PA; and Burnaby, BC; none of whom seem to be in the IMAP software
development business.

---

From: Karsten Ballueder <[email-masked]>
Date: Wed, 9 Sep 1998 17:42:19 +0100 (BST)

> because he was using some library that had that name.

Maybe it would be an option to move to a conflict-avoiding naming
scheme like:

wu_net_open(), wu_mail_open(),... or some other common prefix

One could easily keep the old names preprocessor defined for backwards 
compatibilty.

#ifdef USE_OLD_NAMES
#define net_open wu_net_open
....

That would avoid such problems in the future and it should be possible 
to gradually move to such a new naming scheme.

-- 
 Karsten Ballüder http://Ballueder.home.ml.org/ mailto:[email-masked]
Physics Department, Heriot-Watt University, Edinburgh, EH14 4AS, Scotland
            "In a world without fences, who needs Gates?"

---

From: Mark Musone <[email-masked]>
Date: Wed, 9 Sep 1998 12:24:56 -0400 (EDT)

> wu_net_open(), wu_mail_open(),... or some other common prefix

uw_net_open, uw_mail_open ...

> #define net_open wu_net_open

#define net_open uw_net_open

(dont want to anger MRC while trying to convince him of this big change ;^) )

Mark