recode

François Pinard pinard at iro.umontreal.ca
Tue Sep 21 21:29:19 EDT 1999


Pawel Krawczyk <kravietz at ceti.pl> writes:

> Recently I've been playing with your recode library, and found something
> unexpected.  When linking a program to librecode, the linker complains
> about a non-existent symbol program_name.  [...]  Should it really
> be there?

Ulrich Drepper <drepper at cygnus.com> écrit:

> First, if it's really a library it should never call error().  There should
> never be any output coming from the library functions.  One should report
> on error using an error code and the application wil do the rest.

For `librecode', the user may set the library so it issues the diagnostic
itself and aborts in case of problem.  This capability is quite convenient
for most cases.  Also, in another mode, it does as you suggest, and merely
return error codes, so the library user gets fuller control about it.

But once again, I would rather not force library users to necessarily
check all return codes themselves, with no other choices.  In most simple
applications, letting the library diagnose and abort is easier, and welcome.

This is because both possibilities exist that this `program_name' variable
is needed: this variable is used _when_ `librecode' diagnoses itself.

> Second, if you don't want to do this there is nothing wrong with requiring
> these variables.  Just document this as part of the requirements to use
> the library.

This is what I feel like doing.  The other complaint about `librecode'
using `program_name' came from someone building a Python interface for it.
I do not have that message handy as I write, but I'm Cc:ing a mailing
list for people interested in Python.  As I became interested in Python
myself recently, I'm a bit curious to study this problem more completely.
I guess `program_name' would not cause a problem for Python either, it
might suffice to interface it with the value of `sys.argv[0]', somehow.

Pawel, please tell us is that `program_name' variable a problem for you
in practice, once over the surprise of discovering that it is needed? :-)

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard





More information about the Python-list mailing list