RAVI NANJUNDAPPA | 22 Jun 15:33 2016

Generating doxygen comments for swig-generated C# that wraps C++

Hi All, 

Is it possible to carry-forward the doxygen comments present in C++ code (.h files for classes and methods)
to swig-generated C# bindings ? 

Thanks and Best Regards, 
N Ravi
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
Akira | 21 Jun 10:41 2016
Picon
Picon

[C++ to R] SWIG objects into lists

Hi,

I wrapped a C++ library to R.
I noticed I cannot add the wrapped C++ classes into lists...
I guess this is because of the copying policy (SWIG uses SEXP and therefore
the objects have a different copying policy. This is of course great on the
one hand, because we normally do not want to copy the C++ object everytime
we give it to a function, but probably not good on the other hand since R
seems to insist on copying if you add the objects to a list).

I will make clear what I mean with an example:

I created an instance of a wrapped C++ class in R

> test = WrappedClass()
> test
An object of class "_p_WrappedClass"
Slot "ref":
<pointer: 0x5fa4440>

If I give this instance to a function an change it, the changes will be made
on the original object (This is exactly what I want).

But if I want to put this object into a list the following happens:

> list(test)
[[1]]
Error in (function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘addNextMethod’ for
signature ‘"function"’
(Continue reading)

Jake | 15 Jun 18:52 2016
Picon

Enabling swig::from when needed by custom templated types

I'm trying to wrap some code which includes a custom vector type, let's call it MyVector, 
that is more or less like std::array (templated on size and element type) with a bunch of 
additional operations.  It doesn't conform to the sequence format that would let, e.g. 
traits_from_stdseq in pycontainer.swg to apply (I also don't know how I would make it 
apply if it did), but I took some inspiration from there and tried to write a macro:

%define %MyVector_sequence(size, type)
#ifdef SWIGPYTHON
%typemap(out) MyVector<size, type> {
  PyObject *obj = PyTuple_New((Py_ssize_t)size);
  for (decltype(size) i = 0; i < size; ++i) {
    PyTuple_SetItem(obj, i, swig::from<type>($1[i]));
  }
  $result = obj;
}
#endif
%enddef

With a use such as:

%template(MyVector2c)  MyVector<2, char>;
%MyVector_sequence(2, char);

This produces the error:

'type_name' : is not a member of 'swig::traits<char>'

Now, if this appears elsewhere in a used .i file:

%include "std_vector.i"

namespace std {
  %template(CharVector) vector<char>;
}

Then the traits< char >, traits_asval< char > and traits_from< char > specializations
are generated and swig::from<char> compiles.

So, my main question is what causes this registration and how would I trigger it?  
Secondarily, I wonder if it can be triggered automatically based on the template 
instantiation without using an extra macro for each?  Is it possible to do this 
without modifying the original C++ header or repeating its information?

-Jake Cobb
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Emre Metin | 15 Jun 11:52 2016
Picon

Define typemap just for specified classes in C#

I am newbie to SWIG and using it for C++ to C#.
I want to define a typemap for just specified classes work with it.
How can i do that?

Here is what i want;
StringU is our type in C++ and I would like to convert it in string.
TBLCEGRUPLAR is also our class that we use.

%typemap(cstype) StringU * "string"

%typemap(cstype,cscode) StringU * "string",TBLCEGRUPLAR

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports. http://pubads.g.doubleclick.net/gampad/clk?id=1444514421&iu=/41014381
RAVI NANJUNDAPPA | 14 Jun 09:06 2016

Is it possible to add manual bindings along with the swig auto binding code

Hi All,

Is it possible to use auto binding and manual binding in parallel?
Is there any directive in swig which can be used in the interface to direct swig to not to generate auto
binding or which can be used to add our manual binding code in the interface file ? 

Thanks and Best Regards, 
N Ravi
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
JR Heisey | 13 Jun 03:55 2016

Re: Swig-user Digest, Vol 121, Issue 6

I suggest posting a bug in the bug tracking system.
Look here fir the link.
http://swig.org/bugs.html

J.R. Heisey

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
RAVI NANJUNDAPPA | 11 Jun 15:12 2016

how to pass argc argv values using swig bindings for csharp

Hi All, 

We need to send the C# string[] argument to native C++ code in the char*** format type..
This is like sending string[] args from C# Main to the native  C++ code which expects the argument of type
(char ***argv).
If anyone can share the sample code for doing the same it'd help us a lot.

Thanks and Best Regards, 
N Ravi
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
Alexander Botev | 11 Jun 13:50 2016
Picon

Returning std::strnig does not give me back Python string

Hi, so I'm having the problem as described above. I have a member function of the form:

std::string to_string() const { ... }

which returns by value as suggested by the docs.
My swig file looks like this:
/* File : symbolic.i */
%module symbolic
%{
#include "symbolic.h"
%}
/* Let's just grab the original header file here */
%include "std_string.i"
%include "symbolic.h" 

However, when I call the method  on an object in Python 3 I get:

<Swig Object of type 'std::string *' at 0x7fd21be236c0>

rather than a normal Python string. I'm thinking that there is something very simple which I'm overlooking, but can't figure out what. I was hoping someone can point out to me?

Best regards,
Alex
 
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Valerio Messina | 10 Jun 18:52 2016
Picon

bash support

hi,
I never used Swig and so I'm not sure the following question is relevant or correct.

In the list of supported languages the bash is missing, and at first this is strange to me,
Bash is/has a powerful scripting language, so in my understanding can be supported by swig.
I'm wrong?

OK, bash can call executable generated by C source directly, but passing arguments via command line parameters and main() parsing is cumbersome.
Return of values via 'int return' is ever limiting.
I imagine calling C functions directly has lot more power control.

thanks for clarifications,
Valerio

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user
Akira | 10 Jun 14:47 2016
Picon
Picon

R documentation

I am currently wrapping a C++ library with SWIG into R.
Since i did it before in Python, it works pretty fine for me.
The R documentation is pretty poor and I could supply some documentation but
I have no idea how I should do this. I figured many things out by myself
dince many things are similar to Python. But I guess an example typemap etc.
would not hurt.
On the other hand I found some bugs, especially with typemaps. I know how to
solve them (I manipulate the SWIG generated files with a Python script so
they work afterwards), but i don't where I should report them. Actually I do
not know if the R part of SWIG is currently under any development at all.

Does anybody have some information for me?
BR Rike

--
View this message in context: http://swig.10945.n7.nabble.com/R-documentation-tp14783.html
Sent from the swig-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
denny khoerniawan | 7 Jun 20:51 2016
Picon

swig python - segfault with callbacks

Hi All,

I just started using SWIG to generate APIs for various languages from existing C APIs and I am starting with Python as the first language. Almost everything works very well but the callbacks that I implemented following the instruction from SWIG documentations. There are 2 callback functions that I am having issue with here and here are the wrappers that I declared in my interface file.


static void state_callback_py( state_t new_state, state_t old_state, void* user_data )
{
PyObject *func = NULL;
PyObject *arglist = NULL;
PyObject *result = NULL;

func = (PyObject *) user_data;
arglist = Py_BuildValue("(ii)", (int)new_state, (int)old_state);
result = PyEval_CallObject(func,arglist);
Py_XDECREF(arglist);
Py_XDECREF(result);
}

static void log_callback_py( log_level_t log_level, const char* msg, void* user_data )
{
PyObject *func = NULL;
PyObject *arglist = NULL;
PyObject *result = NULL;

func = (PyObject *) user_data;
arglist = Py_BuildValue("(is)", log_level, msg);
result = PyEval_CallObject(func,arglist);
Py_XDECREF(arglist);
Py_XDECREF(result);
}

status_t state_callback_py( agent_t* lib_handle, PyObject *pyfunc )
{
status_t status;
status = state_callback( lib_handle, state_callback_py, (void *) pyfunc );
Py_INCREF(pyfunc);
return status;
}

status_t log_callback_py( agent_t* lib_handle, PyObject *pyfunc )
{
status_t status;
status = log_callback( lib_handle, log_callback_py, (void *) pyfunc );
Py_INCREF(pyfunc);
return status;
}

I get segfault almost all the time with state_callback_py() (> 90% of the time) and occasionally get it with log_callback_py() (< 1% of the time). and here are the gdb's backtrace for both cases.

for state_callback_py():
#0  0x4a71047c in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#1  0x4a7a883d in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so.1.0
#2  0xb7ed5468 in state_callback_py (new_state=TATE_MAINTENANCE, old_state=STATE_NORMAL, 
    user_data=0xb7f5502c)
    at /buildarea2/dkhoerni/quark/bitbake_build/tmp/work/quark-wrs-linux/hdc/1.0-r5/cmake_build/src/agent-api/common_pythonPYTHON_wrap.c:3378
#3  0xb7eb8086 in common_notification_thread (arg=0xb7ec6400 <lib_handle>)
    at /buildarea2/dkhoerni/quark/bitbake_build/tmp/work/quark-wrs-linux/hdc/1.0-r5/src/agent-api/common.c:193
#4  0x4a38a06b in ?? () from /lib/libpthread.so.0
#5  0x4a2d365e in clone () from /lib/libc.so.6


for log_callback_py()
#0  0x4a71047c in PyObject_Call () from /usr/lib/libpython2.7.so.1.0
#1  0x4a7a883d in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so.1.0
#2  0xb7d174f8 in log_callback_py (log_level=LOG_TRACE, 
    msg=0xa1afdee0 "Handling registration acknowledgement", user_data=0xb7f5c1e4)
    at /buildarea2/dkhoerni/quark/bitbake_build/tmp/work/quark-wrs-linux/hdc/1.0-r5/cmake_build/src/agent-api/common_pythonPYTHON_wrap.c:3392
#3  0xb7cf9d41 in log (lib_handle=0xb7d08400 <lib_handle>, log_level=LOG_TRACE, 
    log_msg_fmt=0xb7d01d58 "Handling registration acknowledgement")
    at /buildarea2/dkhoerni/quark/bitbake_build/tmp/work/quark-wrs-linux/hdc/1.0-r5/src/agent-api/common.c:467
#4  0xb7cfa0de in common_notification_thread (arg=0xb7d08400 <lib_handle>)
    at /buildarea2/dkhoerni/quark/bitbake_build/tmp/work/quark-wrs-linux/hdc/1.0-r5/src/agent-api/common.c:170
#5  0x4a38a06b in ?? () from /lib/libpthread.so.0
#6  0x4a2d365e in clone () from /lib/libc.so.6

Can someone help me explain what is going on here? I just find it really weird that those 2 functions are implemented almost exactly the same way, but behave differently. and why is it intermittent? I have more callbacks that are called less often and I suspect they will have the same issue. Am I missing something here? I have been struggling with this for over a week now, I would really appreciate any help I can get.

Thanks,
Denny

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Swig-user mailing list
Swig-user <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user

Gmane