I've just got round to looking at the INIT block issue properly and I've
found a couple of alternative techniques. (Though I see now why you used
the INIT block in the first place. Given the way SWIG works it is tricky
finding a good insertion point.)

First though, the things that don't work: A BEGIN block doesn't work
because that gets executed as soon as the compiler sees it. Compilation
hasn't finished at that point, so it can't call things that are defined
in that module. The other obvious approach is to not put the Initialize
call inside any block at all but to just put it in the definition of
XML::Xerces and have it executed as the last stage of compiling the
module. But that fails because XML::Xerces::XMLPlatformUtils::Initialize
is actually a mapping to XML::Xercesc::XMLPlatformUtils_Initialize which
is set up inside XML::Xerces::XMLPlatformUtils.

So, the solutions: The more pleasant of the two possibilities is to
insert the Initialize call inside XMLPlatformUtils somewhere after the
long series of name mappings. That might be possible with SWIG, I don't
know. (I've never used SWIG. It wasn't obvious from the documentation
how to insert arbitrary code at that point.)

The slightly less pleasant solution is to put a call to
XML::Xercesc::XMLPlatformUtils_Initialize at the top of Xerces-extra.pm
(roughly where the INIT block is now). It's a little bit ugly to use
that name directly, but at that point in the code it's the only name
available.

How do either of those options sound? Let me know if I haven't explained
myself clearly.

colin

http://www.bbc.co.uk/

This e-mail (and any attachments) is confidential and may contain
personal views which are not the views of the BBC unless specifically
stated.
If you have received it in error, please delete it from your system. 
Do not use, copy or disclose the information in any way nor act in
reliance on it and notify the sender immediately. Please note that the
BBC monitors e-mails sent or received. 
Further communication will signify your consent to this.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to