Please help me in writing SWIG interace.
I want to open a database connection handle in C program. This handle must be passed to Perl, where I will use the Perl DB interface for interacting with the database. For security purpose we wanted to use this mechanism. I want to pass the database handle using SWIG interface.
Added:
We are ...
I would like to know how to use python to make calls to a C++ library called libwpd to read word perfect files and build python objects from them, but I have no experience with C++ or calling C++ functions from python, and I don't understand how to figure out what the output of these library functions would be. So that's really two quest...
I have C++ objects and I have Lua objects/tables. (Also have SWIG C++ bindings.)
What I need to be able to do is associate the two objects so that if I do say
CObject* o1 = getObject();
o1->Update();
it will do the equivalent Lua:
myluatable1.Update();
So far I can imagine that CObject::Update would have the following code:
void ...
Y'all,
I've been at to for 3 days trying to get OpenCV Python binds happening, and I have (the full epic struggle is documented here) but despite turning the SWIG flag on in CMake after installing swig via macports, I'm not getting any SWIG action :(
My cmake command looks like:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFI...
I have a SWIG C++ function that expects a function pointer (WNDPROC), and want to give it a Python function that has been wrapped by ctypes.WINFUNCTYPE.
It seems to me that this should be compatible, but SWIG's type checking throws an exception because it doesn't know that the ctypes.WINFUNCTYPE type is acctually a WNDPROC.
What can I ...
I have created a buffer object in python like so:
f = io.open('some_file', 'rb')
byte_stream = buffer(f.read(4096))
I'm now passing byte_stream as a parameter to a C function, through SWIG. I have a typemap for converting the data which looks like this:
%typemap(in) unsigned char * byte_stream {
PyObject *buf = $input;
//some...
swig -php example.i
This will produce 3 files example_wrap.c, php_example.h and example.php. The first file, example_wrap.c contains all of the C code needed to build a PHP extension. The second file, php_example.h contains the header information needed if you wish to statically link the extension into the php interpreter. The third fil...
Hello all,
This is Python question. I have a variable A
>>> A
<Swig Object of type 'uint16_t *' at 0x8c66fa0>
>>> help(A)
class PySwigObject(object)
Swig object carries a C/C++ instance pointer
The instance referred by A is a contiguous array uint16[3] and the problem is to gain access to that array from Python.
In Python, how c...
Hi, I'm trying to create a python script that will disassemble a binary (a Windows exe to be precise) and analyze its code.
I need the ability to take a certain buffer, and extract some sort of struct containing information about the instructions in it.
I've worked with libdisasm in C before, and I found it's interface quite intuitive a...
Right now I'm using JNA for Java-native communication and am pleased with its simplicity. However I do need to optimize performance and am considering using other bindings.
My question is this: what part of Java-native communication is the "expensive" part? Is it the passing of data between them?
Let me put it another way. Right now t...
here's the deal.
i'm using MinGW to build a pythonC module using Swig. when i tell python to load the module, it fails and complains that python cannot find the module.
the funny thing is that the module is in the same directory (cwd) that i'm running python under and the module is named _mod.pyd. (i also have the generated mod.py file...
I've been working on a statistical translation system for haiti (code.google.com/p/ccmts) that uses a C++ backend (http://www.statmt.org/moses/?n=Development.GetStarted) and Python drives the C++ engine/backend.
I've passed a UTF-8 Python string into a C++ std::string, done some processing, gotten a result back into Python and here is t...
I've been working on getting my library c++ Lavish working with ruby using swig. The issue is that only some of the classes I've included in the interface file can be used and I get no errors during compilation of the bundle or loading in ruby. My swig interface file can be viewed here.
An example of what works and what doesn't.
sean$ ...
I've been trying to use SWIG to wrap around a simple library that uses ioctl() to populate a structure like the following:
struct data
{
header* hdr;
void* data;
size_t len;
};
data is a pointer to a buffer, len is the length of that buffer.
I'm unable to figure out how to convert data to a Python string (or array). Furthermore...
This is probably a multi-part question. Background: we have a native (c++) library that is part of our application and we have managed to use SWIG to generate a perl wrapper for this library. We'd now like to distribute this perl module as part of our application.
My first question - how should I distribute this module? Is there a sta...
I am extending an interface with lua, and I've run into a problem in that I would need to pass pointers to objects to the lua code to work upon. These classes will have been wrapped via SWIG, and I could instantiate them via lua using swig, but that would leave me with useless objects.
I need to be able to pass a callback object to lua,...
I'm using SWIG to wrap C++ objects for use in lua, and Im trying to pass data to a method in my lua script, but it always comes out as 'nil'
void CTestAI::UnitCreated(IUnit* unit){
lua_getglobal(L, "ai");
lua_getfield(L, -1, "UnitCreated");
swig_module_info *module = SWIG_GetModule( L );
swig_type_info *type = SWIG_TypeQ...
Hi,
when generating python wrappers with swig the python wrapper classes in the generated python file do not have an explicit self parameter, for example see below:
class PySwigIterator(_object):
def value(*args): return _spatiotemporalnmf.PySwigIterator_value(*args)
def incr(*args): return _spatiotemporalnmf.PySwigIterator_inc...
I'm using the Ruby SVN bindings built with SWIG. Here's a little tutorial.
When I do this
@repository = Svn::Repos.open('/path/to/repository')
I can access the repository fine. But when I do this
@repository = Svn::Repos.open('svn://localhost/some/path')
It fails with
/SourceCache/subversion/subversion-35/subversion/subversion/li...
hey,
I have a firmware for an USB module I can already control by visual C. Now I want to port this to python. for this I need the octopus library which is written in c. I found a file called octopus_wrap which was created by SWIG!
then I found a makefile which says:
python2.5:
swig -python -outdir ./ ../octopus.i
gcc ...