Many of my c++ objects implement rerfrence counting through AddRef and FreeRef methods. If FreeRef reduces the refrence count to 0 then the object deletes its self.
All methods which return a refrence counted object dont increment the refrence. This makes it simple since a smart pointer can then simply increment the count apon recieving...
I am trying to get Python running with swig to do C/C++. I am running the tutorial here, 'building a python module'. When I do the call
gcc -c example.c example_wrap.c -I /my_correct_path/python2.5
I get an error:
my_correct_path/python2.5/pyport.h:761:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc ...
Hello all!
I'm trying to wrap the Patricia Tries (Perl's NET::Patricia) to be exposed in python. I am having difficulty with one of the classes.
So instances the patricia node (below) as viewed from python have a "data" property. Reading it goes fine, but writing to it breaks.
typedef struct _patricia_node_t {
u_int bit; /* ...
Where can I find precompiled Python SWIG SVN bindings for Windows?
...
Hi all
I hit this issue about two years ago when I first implemented our SWIG bindings. As soon as we exposed a large amount of code we got to the point where SWIG would output C++ files so large the compiler could not handle them. The only way I could get around the issue was to split up the interfaces into multiple modules and to co...
Is there any other way to debug swig extensions except for doing
gdb python stuff.py
?
I have wrapped the legacy library libkdtree++ and followed all the swig related memory managemant points (borrowed ref vs. own ref, etc.). But still, I am not sure whether my binding is not eating up memory. It would be helpful to be able to ju...
I'm working on a C++ project with a large number of classes (150+), each of which has anywhere from 10 to 300 fields or so. I would really like to be able to provide a scripting interface for testing purposes so that I can code callbacks that don't require any re-compilation. I'd like to do this in Lua since I'm more familiar with its C ...
I'm just now diving into SWIG as a means for creating Lua bindings, and I've hit a snag. I made my interface file and built a shared object file from it all without any problems. However, when I run Lua and try to require the shared object, I get the following:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
require("my_example")...
I notice that in the generated SWIG wrappers for a given set of classes, SWIG keeps a list of C-string representations of all the parent classes from which that class inherits. (char ** base_names). I know there is a function
swig_type(some_variable)
that will return a string representation of a given variable's data type. Is there al...
I'm using swig to wrap a class from a C++ library with python. It works overall, but there is an exception that is thrown from within the library and I can't seem to catch it in the swig interface, so it just crashes the python application!
The class PyMonitor.cc describes the swig interface to the desired class, Monitor.
Monitor's cons...
I'm trying to build a set of Lua bindings for a collection of C++ classes, but have been toying with Python to see if I get better results. In either language the bindings seem to work, however, when I initialize an instance of a class that contains members of other classes, those data members do not seem to be guaranteed to be initializ...
I have a very complicated class for which I'm attempting to make Python wrappers in SWIG. When I create an instance of the item in Python, however, I'm unable to initialize certain data members without receiving the message:
>>> myVar = myModule.myDataType()
swig/python detected a memory leak of type 'MyDataType *', no destructor found....
I have a function in C++ that takes in an std::istream as the input:
class Foo {
Foo(std::istream &);
}
Using SWIG, I've bound it to Ruby, but Ruby's $stdin variable is fundamentally different from anything like the stream classes in C++, so I'm not sure how to either 1) expose the C++ class to Ruby in a way that I can use $stdin,...
I created a lua module with a very large number of wrapped C++ classes using swig. The wrappers are generated and compiled (with -Wall) without any issues. However, in a couple of places that I've found, I run into the following issue: basic assignment of member data fails.
If I run:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio...
I notice that Swig provides a whole host of functions to allow for typecasting objects to their parent classes. However, in C++ one can produce a function like the following:
A * getAnObject()
{
if(someBoolean)
return (A *) new B;
else
return (A *) new C;
}
Where "A" is the parent of classes "B" and "C". One can then typec...
I'm trying to create a Perl hash from within a C library. Here's what I've got so far:
static void add_string_to_perl_hash ( HV *hv, char * key, char *value ) {
SV *obj = sv_2mortal(newSVpv(value, 0));
hv_store(hv, (const char *)key, strlen (key), obj, 0);
SvREFCNT_inc(obj);
}
SV * do_get_test_hash () {
static char *foo ="foo"...
I am the new maintainer for an in-house Python system that uses a set of 3rd-party shared C libraries via a shared library shim that is created using a combination of swig and a setup.py script. This has been working well until recently.
The 3rd-party shared C libraries were updated for new functionality and now I get the following run-...
Question:
Why is my C++ swigged object losing its type when passed to a Java callback function?
Setup:
I've taken the Swig Java example for doing callbacks and added an object to be passed to the callback run(Parent p). The callback works as expected but when I pass a Child object the Java seems to lose its type and think its of type Pa...
Ok, here's a problem I'm having.
I have Lua bindings to a rendering engine that has an internal render manager that keeps its own track of pointers for the render scene and manages them. The problem is that when I'm using it from Lua, if i don't keep a Lua reference to every single object i add to the C++ render manager, it starts to ga...
We have a Java application that uses some C++ libraries through JNI. The application used to work just fine in Windows XP, but it does not work in Windows Vista, it just crashes the JVM right away.
We also wrote the C++ libraries and produced JNI bindings using SWIG.
We are a little bit clueless on where to start looking for a way to f...