1

My application is built in C/C++. And it has an interface, which I would need to use.

The interface contains many *.h files. For example, mycallbacks.h :

/* mycallbacks.h */
#pragma once
#include <cstdint>
#include "commons.h"

typedef void (*SomeCallback)(int arg0 , int arg2);
SOMEMACRO StatusCode SetSomeCallback( void* context, SomeCallback scb);

Now, I need to wrap my C/C++ application into Java, using SWIG. And so I would need *.dll files and the interface *.h files, using SWIG.

How should the SWIG interface look like for "mycallbacks.i" file?

Thank a lot!

user3169231
  • 257
  • 3
  • 13
  • My answer: http://stackoverflow.com/questions/12210129/how-should-i-write-the-i-file-to-wrap-callbacks-in-java-or-c-sharp/12251183#12251183 covers something very similar. Does that do it for you or could you elaborate on what's different? – Flexo Feb 07 '14 at 08:06
  • Do you have any control over the callback signature (function(int, int) returning void") and over the SetSomeCallback? If you do, you can definitely do it, although not trivial. What is the context variable, how is it used? This could be a problem too. – Oliver Feb 07 '14 at 18:54

0 Answers0