[natas at orodu.net: Re: [Swig] multiple interfaces in one project]
Ben Jansens
ben at orodu.net
Fri Jan 3 18:11:46 EST 2003
If you wanna try compile openbox from CVS, then youll need to compile
swig with this patch.
Enjoy (-:
----- Forwarded message from Natas <natas at orodu.net> -----
From: Natas <natas at orodu.net>
Subject: Re: [Swig] multiple interfaces in one project
To: David Beazley <beazley at cs.uchicago.edu>
Cc: SWIG list <swig at cs.uchicago.edu>
Delivery-date: Tue, 24 Dec 2002 18:08:44 -0600
On Tue, Dec 24, 2002 at 03:50:31PM -0600, David Beazley wrote:
> Natas writes:
> > Hi again all,
> >
> > I've hit another seeming brick wall :\
> >
> > I've got 2 interfaces in my project, "otk" and "openbox". They are
> > separate interfaces but i want to give out both in my
> > application. However, when I generate each one's wrapper.cc and link
> > it all together..
> >
> > otk_wrap.o(.text+0x1e0): multiple definition of `SwigNumber_AsDouble(_object*)'
> >
> > etc.. Lots of that. Any way to make this play nice?
> >
>
> I have no idea what module is responsible for SwigNumber_AsDouble().
> However, ignoring that detail for a moment, the standard way to do
> this is to link the modules into separate shared objects and use the
> SWIG runtime libraries. Some details (out of date) are found in
> "Advanced Topics" section of the SWIG documentation. Examples can be
> found Examples/python/import (or similar directory for whatever target
> you're using).
>
> By the way, what target language is this? We should probably fix the
> duplicate definition problem by adding some "static" qualifiers in a
> few places.
If you haven't looked at this yet, I can help make your life easier :)
Patch attached.
Natas
--
I am damn unsatisfied to be killed in this way.
--- tmp/SWIG-1.3.17/Lib/python/std_common.i Sat Aug 3 11:16:38 2002
+++ work/SWIG-1.3.17/Lib/python/std_common.i Tue Dec 24 18:04:01 2002
@@ -8,19 +8,19 @@
%{
#include <string>
-PyObject* SwigInt_FromBool(bool b) {
+static PyObject* SwigInt_FromBool(bool b) {
return PyInt_FromLong(b ? 1L : 0L);
}
-double SwigNumber_Check(PyObject* o) {
+static double SwigNumber_Check(PyObject* o) {
return PyFloat_Check(o) || PyInt_Check(o);
}
-double SwigNumber_AsDouble(PyObject* o) {
+static double SwigNumber_AsDouble(PyObject* o) {
return (PyFloat_Check(o) ? PyFloat_AsDouble(o) : double(PyInt_AsLong(o)));
}
-PyObject* SwigString_FromString(const std::string& s) {
+static PyObject* SwigString_FromString(const std::string& s) {
return PyString_FromString(s.c_str());
}
-std::string SwigString_AsString(PyObject* o) {
+static std::string SwigString_AsString(PyObject* o) {
return std::string(PyString_AsString(o));
}
%}
----- End forwarded message -----
--
I am damn unsatisfied to be killed in this way.
http://www.icculus.org/openbox/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <http://icculus.org/pipermail/openbox/attachments/20030103/41835b82/attachment.pgp>
More information about the openbox
mailing list