Hi

Iam new to Swig Tool.

Iam getting following error "The crash happened outside the Java Virtual Machine in native code." .

Why it is getting like this.I want to talk with somebody who knows well swig-java.

Iam struggling with this last one month.

Please help on this.

With  regards,

Dasari Srinivas

Electronic Brake Systems
Continental Technical Center (India)
Ozone Manay Tech Park, 4th Floor
56/18, 55/9 G.B. Palya
Hosur Main Road, Bomanahalli
Bangalore - 560068, INDIA

Phone:  +91 - (0)80 - 3918 - 6204
Email:dasari.srinivas-ext@continental-corporation.com
http://www.continental-corporation.com



From:        swig-user-request@lists.sourceforge.net
To:        swig-user@lists.sourceforge.net
Date:        09/21/2011 04:24 PM
Subject:        Swig-user Digest, Vol 64, Issue 14




Send Swig-user mailing list submissions to
                swig-user@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
               
https://lists.sourceforge.net/lists/listinfo/swig-user
or, via email, send a message with subject or body 'help' to
                swig-user-request@lists.sourceforge.net

You can reach the person managing the list at
                swig-user-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Swig-user digest..."


Today's Topics:

  1. Re: Fwd: How to typemap u8*(unsigned char *) to java                 byte[]
     (jbyteArray)? (Stefan Reusch)
  2. Re: Swig-user Digest, Vol 64, Issue 13
     (Dasari.Srinivas-EXT@continental-corporation.com)


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Sep 2011 17:18:03 +0000 (UTC)
From: Stefan Reusch <kenterfie@googlemail.com>
Subject: Re: [Swig-user] Fwd: How to typemap u8*(unsigned char *) to
                java                 byte[] (jbyteArray)?
To: swig-user@lists.sourceforge.net
Message-ID: <loom.20110920T191435-84@post.gmane.org>
Content-Type: text/plain; charset=us-ascii

Mathieu Malaterre <mathieu.malaterre <at> gmail.com> writes:

>
> On Sun, Sep 18, 2011 at 10:38 PM, Stefan Reusch
> <kenterfie <at> googlemail.com> wrote:
> > Hi Jose,
> >
> > i know, the topic is some month old, but i have the same problem and i cant
find
> > something about a solution for it. it would be great, when you find a
solution
> > to give me some help to implement it into my own project.
>
> I have been using this to do something very similar:
>
> %include "arrays_java.i"
> JAVA_ARRAYS_IMPL(char, jbyte, Byte, Char)
> JAVA_ARRAYS_TYPEMAPS(char, byte, jbyte, Char, "[B")
> %typecheck(SWIG_TYPECHECK_INT8_ARRAY) /* Java byte[] */
>    signed char[ANY], signed char[]
>    ""
> %typemap(memberin) charANY], char[];
> %typemap(globalin) charANY], char[];
>
> HTH

Thanks for your help, but it doesnt fixed my problem.

I get ever this message
ogp_swig.h(32) : Warning 810: No jni typemap defined for int for use in OGPCallb
acks::SendTo (skipping director method)

My interface file looks like
%include "typemaps.i"
%include "arrays_java.i"

typedef unsigned char ogp_uint8_t;
typedef unsigned short ogp_uint16_t;
typedef unsigned long ogp_uint32_t;
typedef unsigned __int64 ogp_uint64_t;

typedef signed char ogp_int8_t;
typedef signed short ogp_int16_t;
typedef signed long ogp_int32_t;
typedef signed __int64 ogp_int64_t;

typedef char OGP_CHAR;

#if defined(SWIGJAVA)
%typemap(in)     (char *BYTE, int LENGTH) {
/* Functions from jni.h */
$1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0);
$2 = (int)    JCALL1(GetArrayLength,       jenv, $input);
}
%typemap(jni)    (char *BYTE, int LENGTH) "jbyteArray"
%typemap(jtype)  (char *BYTE, int LENGTH) "byte[]"
%typemap(jstype) (char *BYTE, int LENGTH) "byte[]"
%typemap(javain) (char *BYTE, int LENGTH) "$javainput"

%typemap(argout) char *BYTE {
                JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *) $1, 0);
}

%typemap(javain) char *BYTE "$javainput"
%typemap(freearg) char *BYTE ""

/* Specify signature of method to handle */
%apply (char *BYTE, int LENGTH)   { (char * byteArray, long len) };
#else
%apply (char *STRING, int LENGTH) { (char * byteArray, long len) };
#endif

and works good, only exception is the missing director class functions
for

class OGPCallbacks {
public:
                virtual ~OGPCallbacks() { }
                virtual void SendTo(char *BYTE, int LENGTH, const char* addrstr, int
port) { }
                virtual void UpdateServerData(ogp_serverdata_t* pServerData) { }
                virtual int IsBanned(const char* addrstr) { return 0; }
};

or better for the sendto function only

someone knows where the problem is or how the missing typemap looks like?

regards
Stefan R.






------------------------------

Message: 2
Date: Wed, 21 Sep 2011 16:22:51 +0530
From: Dasari.Srinivas-EXT@continental-corporation.com
Subject: Re: [Swig-user] Swig-user Digest, Vol 64, Issue 13
To: swig-user@lists.sourceforge.net
Message-ID:
                <OF6242E1D2.CF1F4106-ON65257912.003AF0A9-65257912.003BC4B3@continental-corporation.com>
               
Content-Type: text/plain; charset="us-ascii"

HI

I am facing one problem like "The crash happened outside the Java Virtual
Machine in native code".

This is happening while getting list of the values from database by
passing array objects from Java to c language.

for that Iam using %array_functions(UdbEntity* ,UdbEntityP); which is in
carray.i file.

Please send one example like how pass array objects.

Please help on this.



With  regards,

Dasari Srinivas
Electronic Brake Systems
Continental Technical Center (India)
Ozone Manay Tech Park, 4th Floor
56/18, 55/9 G.B. Palya
Hosur Main Road, Bomanahalli
Bangalore - 560068, INDIA

Phone:  +91 - (0)80 - 3918 - 6204
Email:dasari.srinivas-ext@continental-corporation.com
http://www.continental-corporation.com



From:   swig-user-request@lists.sourceforge.net
To:     swig-user@lists.sourceforge.net
Date:   09/20/2011 07:08 PM
Subject:        Swig-user Digest, Vol 64, Issue 13



Send Swig-user mailing list submissions to
                swig-user@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
               
https://lists.sourceforge.net/lists/listinfo/swig-user
or, via email, send a message with subject or body 'help' to
                swig-user-request@lists.sourceforge.net

You can reach the person managing the list at
                swig-user-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Swig-user digest..."


Today's Topics:

  1. Re: Call signature difference between SWIG 1.3 and 2.0
     (Teemu Ikonen)
  2. Re: Swig-user Digest, Vol 64, Issue 12
     (Dasari.Srinivas-EXT@continental-corporation.com)


----------------------------------------------------------------------

Message: 1
Date: Tue, 20 Sep 2011 14:51:39 +0200
From: Teemu Ikonen <tpikonen@gmail.com>
Subject: Re: [Swig-user] Call signature difference between SWIG 1.3
                and 2.0
To: William S Fulton <wsf@fultondesigns.co.uk>
Cc: swig-user@lists.sourceforge.net
Message-ID:
<CAH-FRAKjQdEYgFSBYXq_t2A2ezb84LL1ykx=cZ2USN162yaVVQ@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Sep 19, 2011 at 11:23 PM, William S Fulton
<wsf@fultondesigns.co.uk> wrote:
> It is now fixed for swig-2.0.5, see
>
http://swig.svn.sourceforge.net/swig/?rev=12814&view=rev
>
> Until it is released, you could use %exception as a workaround to
replace
> the call to the wrapped function.

Hello William,

Many thanks for the rapid fix.

Best,

Teemu



------------------------------

Message: 2
Date: Tue, 20 Sep 2011 19:06:38 +0530
From: Dasari.Srinivas-EXT@continental-corporation.com
Subject: Re: [Swig-user] Swig-user Digest, Vol 64, Issue 12
To: swig-user@lists.sourceforge.net
Message-ID:

<OF970FA53A.00E803FC-ON65257911.004AAB88-65257911.004AC3EF@continental-corporation.com>

Content-Type: text/plain; charset="us-ascii"

Hi

Please send me one example for %array_functions in carrays.i.

With  regards,

Dasari Srinivas
Electronic Brake Systems
Continental Technical Center (India)
Ozone Manay Tech Park, 4th Floor
56/18, 55/9 G.B. Palya
Hosur Main Road, Bomanahalli
Bangalore - 560068, INDIA

Phone:  +91 - (0)80 - 3918 - 6204
Email:dasari.srinivas-ext@continental-corporation.com
http://www.continental-corporation.com



From:   swig-user-request@lists.sourceforge.net
To:     swig-user@lists.sourceforge.net
Date:   09/20/2011 09:56 AM
Subject:        Swig-user Digest, Vol 64, Issue 12



Send Swig-user mailing list submissions to
                swig-user@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
               
https://lists.sourceforge.net/lists/listinfo/swig-user
or, via email, send a message with subject or body 'help' to
                swig-user-request@lists.sourceforge.net

You can reach the person managing the list at
                swig-user-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Swig-user digest..."


Today's Topics:

  1. Re: Call signature difference between SWIG 1.3 and 2.0
     (William S Fulton)
  2. Re: Question about wrapping C++ classes to be returned to
     Python as Python objects (Stefan Zager)
  3. Re: problems with swig/distutils/numpy (Stefan Zager)
  4. Re: problems with swig/distutils/numpy (cthulhum)
  5. Re: Question about wrapping C++ classes to be returned to
     Python as Python objects (Anil Gurnani)
  6. Re: Question about wrapping C++ classes to be returned to
     Python as Python objects (Stefan Zager)


----------------------------------------------------------------------

Message: 1
Date: Mon, 19 Sep 2011 22:23:58 +0100
From: William S Fulton <wsf@fultondesigns.co.uk>
Subject: Re: [Swig-user] Call signature difference between SWIG 1.3
                and 2.0
To: Teemu Ikonen <tpikonen@gmail.com>
Cc: swig-user@lists.sourceforge.net
Message-ID: <4E77B2EE.5010400@fultondesigns.co.uk>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

On 19/09/11 14:55, Teemu Ikonen wrote:
> Hello all,
>
> I'm trying to compile a Python SWIG interface to to Coin3D
> (coin3d.org) called pivy (see
>
http://hg.sim.no/Pivy/default/file/8eab90908f2a/interfaces for the
> interface code). The interface generation used to work perfectly with
> the swig 1.3 series, but with swig 2.0.4 compilation of the generated
> wrapper code fails.
>
> It turns out that the problem appears when a call to a function with a
> function pointer reference argument is made. The function causing the
> problem has this signature:
>
>      static SbBool getHeaderData(const SbString&  headerstring,
>                                SbBool&  isbinary,
>                                float&  ivversion,
>                                SoDBHeaderCB *&  precallback,
>                                SoDBHeaderCB *&  postcallback,
>                                void *&  userdata,
>                                SbBool substringok = FALSE);
>
> where SoDBHeaderCB is
>
>      typedef void SoDBHeaderCB(void * data, SoInput * input);
>
> Version 1.3 produces this call in the generated Python extension code:
>
> result = (SbBool)SoDB::getHeaderData((SbString const
> &)*arg1,*arg2,*arg3,*arg4,*arg5,*arg6,arg7);
>
> and version 2.0.4:
>
> result = (SbBool)SoDB::getHeaderData((SbString const
> &)*arg1,*arg2,*arg3,arg4,arg5,*arg6,arg7);
>
> i.e. args 4 and 5 are not dereferenced, although rest of the argument
> unpacking code in the Python extension is identical between the two
> swig versions. When compiling, a matching getHeaderData function is
> not found, causing this error with swig 2.0.4:
>
> pivy/coin_wrap.cpp: In function 'PyObject*
> _wrap_SoDB_getHeaderData__SWIG_0(PyObject*, PyObject*)':
> pivy/coin_wrap.cpp:35402:96: error: no matching function for call to
> 'SoDB::getHeaderData(const SbString&, SbBool&, float&, void
> (**&)(void*, SoInput*), void (**&)(void*, SoInput*), void*&, SbBool&)'
> pivy/coin_wrap.cpp:35402:96: note: candidate is:
> /usr/include/Inventor/SoDB.h:65:17: note: static SbBool
> SoDB::getHeaderData(const SbString&, SbBool&, float&, void (*&)(void*,
> SoInput*), void (*&)(void*, SoInput*), void*&, SbBool)
> /usr/include/Inventor/SoDB.h:65:17: note:   no known conversion for
> argument 4 from 'void (**)(void*, SoInput*)' to 'void (*&)(void*,
> SoInput*)'
>
> See here
http://people.debian.org/~lucas/logs/2011/08/22/pivy_0.5.0~svn765-2_lsid64.buildlog


> for a full Debian build log.
>
> There are no typemaps affecting function pointers in the interface
> code that I can find, so this looks to me like a genuine regression in
> swig. Any hints on how to get this interface working?
>

It is now fixed for swig-2.0.5, see
http://swig.svn.sourceforge.net/swig/?rev=12814&view=rev

Until it is released, you could use %exception as a workaround to
replace the call to the wrapped function.

William



------------------------------

Message: 2
Date: Mon, 19 Sep 2011 16:27:59 -0700
From: Stefan Zager <szager@gmail.com>
Subject: Re: [Swig-user] Question about wrapping C++ classes to be
                returned to Python as Python objects
To: Anil Gurnani <anil.gurnani@gmail.com>
Cc: swig-user@lists.sourceforge.net
Message-ID:
<CANDG7WRF4pYJFFc=Db7pFvWdoeSEiJe8AuM-qu5+oTGbFe+zLw@mail.gmail.com>
Content-Type: text/plain; charset="windows-1252"

On Sun, Sep 18, 2011 at 7:32 AM, Anil Gurnani
<anil.gurnani@gmail.com>wrote:


> The C++ class that I want to return back to Python is contained as an
> instance variable in the CPPClass (actually it?s like a linked list ?
where
> a node has a pointer to another node).
>

Can you explain why sometimes you return a wrapped object, and other times
you return a float?  That's the part that makes me think this should be a
pure-python method.

Stefan
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 3
Date: Mon, 19 Sep 2011 16:34:33 -0700
From: Stefan Zager <szager@gmail.com>
Subject: Re: [Swig-user] problems with swig/distutils/numpy
To: cthulhum <davidjoh@buffalo.edu>
Cc: swig-user@lists.sourceforge.net
Message-ID:
<CANDG7WRrPeyhJ1DYJu4Sr0k2Yhw7FxB67wBPdfaNhe7zxOWPRg@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Sun, Sep 18, 2011 at 1:12 PM, cthulhum <davidjoh@buffalo.edu> wrote:
>
> I'm currently trying to wrap a small C++ library with SWIG (though I
only
> need to access methods from one class), with the goal of accessing one
class
> and a few of its methods from python+numpy. ?My Extension setup looks
like
> this ...

SWIG typically doesn't mix too well with distutils and/or scons.  If
you showed me the g++ linker command you're running, I'm pretty sure I
could debug this.

Stefan



------------------------------

Message: 4
Date: Mon, 19 Sep 2011 19:27:15 -0700 (PDT)
From: cthulhum <davidjoh@buffalo.edu>
Subject: Re: [Swig-user] problems with swig/distutils/numpy
To: swig-user@lists.sourceforge.net
Message-ID: <32499873.post@talk.nabble.com>
Content-Type: text/plain; charset=us-ascii


Yeah, I came to that same conclusion myself and just started running the
swig
and g++ commands manually instead, and that seems to be working.  I think
the problem may have been the missing "-shared" argument in the linker
command distutils was issuing (it's the one at the top of the error-log I
posted).



Stefan Zager-2 wrote:
>
> SWIG typically doesn't mix too well with distutils and/or scons.  If
> you showed me the g++ linker command you're running, I'm pretty sure I
> could debug this.
>
> Stefan
>
>

--
View this message in context:
http://old.nabble.com/problems-with-swig-distutils-numpy-tp32482736p32499873.html


Sent from the swig-user mailing list archive at Nabble.com.




------------------------------

Message: 5
Date: Mon, 19 Sep 2011 22:46:07 -0400
From: "Anil Gurnani" <anil.gurnani@gmail.com>
Subject: Re: [Swig-user] Question about wrapping C++ classes to be
                returned                to Python as Python objects
To: "'Stefan Zager'" <szager@gmail.com>
Cc: swig-user@lists.sourceforge.net
Message-ID: <4e77fe33.e71c340a.5134.ffff91ef@mx.google.com>
Content-Type: text/plain; charset="us-ascii"

We have a library similar to AVRO (or Protocol Buffers) to pack data
structures for transmission using TCP/IP or Message Queues or plain old
files on disk. The container can have any type of element. We want to
offer
Python like interface for our Python users like below:



MyContainer[0] = 3.4

MyContainer[1] = 'abc'

MyContainer[2] = nestedContainer;



And so on..



In fact I want to go a step further and be able to give

MyContainer['myfloat'] = 3.3

MyContainer['mystring'] = 'abc'



Print MyContainer['myfloat']

Print MyContainer[1]



And ideally, I would also like

MyContainer['nestedContainer']['myint'] = 4



This last one is very tricky as I want to use the same memory space. I did
actually manage to figure out how to combine boost and shared_ptr and have

a
working version for some of it - but the last usage is really tricky and I
am still trying to figure that one out. Any suggestions/ideas or any
pointers on what I should read up/refer to will be greatly appreciated.



Thanks and Regards,

Anil





From: Stefan Zager [
mailto:szager@gmail.com]
Sent: Monday, September 19, 2011 7:28 PM
To: Anil Gurnani
Cc: swig-user@lists.sourceforge.net
Subject: Re: [Swig-user] Question about wrapping C++ classes to be
returned
to Python as Python objects



On Sun, Sep 18, 2011 at 7:32 AM, Anil Gurnani <anil.gurnani@gmail.com>
wrote:



The C++ class that I want to return back to Python is contained as an
instance variable in the CPPClass (actually it's like a linked list -
where
a node has a pointer to another node).



Can you explain why sometimes you return a wrapped object, and other times
you return a float?  That's the part that makes me think this should be a
pure-python method.



Stefan



-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------


Message: 6
Date: Mon, 19 Sep 2011 21:24:08 -0700
From: Stefan Zager <szager@gmail.com>
Subject: Re: [Swig-user] Question about wrapping C++ classes to be
                returned to Python as Python objects
To: Anil Gurnani <anil.gurnani@gmail.com>
Cc: swig-user@lists.sourceforge.net
Message-ID:
<CANDG7WSDqENn3v+GPNUjj55VKzcS64qGmv3K7hv_PrfBS-MbkQ@mail.gmail.com>
Content-Type: text/plain; charset=windows-1252

OK, that makes sense.  Next question: how do you deal with the type
polymorphism in the C++ interface?  What are the C++ method
declarations for getting, setting, or checking the type of a value
stored in your container class?

Stefan

On Mon, Sep 19, 2011 at 7:46 PM, Anil Gurnani <anil.gurnani@gmail.com>
wrote:
> We have a library similar to AVRO (or Protocol Buffers) to pack data
> structures for transmission using TCP/IP or Message Queues or plain old
> files on disk. The container can have any type of element. We want to
offer
> Python like interface for our Python users like below:
>
>
>
> MyContainer[0] = 3.4
>
> MyContainer[1] = ?abc?
>
> MyContainer[2] = nestedContainer;
>
>
>
> And so on?.
>
>
>
> In fact I want to go a step further and be able to give
>
> MyContainer[?myfloat?] = 3.3
>
> MyContainer[?mystring?] = ?abc?
>
>
>
> Print MyContainer[?myfloat?]
>
> Print MyContainer[1]
>
>
>
> And ideally, I would also like
>
> MyContainer[?nestedContainer?][?myint?] = 4
>
>
>
> This last one is very tricky as I want to use the same memory space. I
did
> actually manage to figure out how to combine boost and shared_ptr and
have a
> working version for some of it ? but the last usage is really tricky and

I
> am still trying to figure that one out. Any suggestions/ideas or any
> pointers on what I should read up/refer to will be greatly appreciated.
>
>
>
> Thanks and Regards,
>
> Anil
>
>
>
>
>
> From: Stefan Zager [
mailto:szager@gmail.com]
> Sent: Monday, September 19, 2011 7:28 PM
>
> To: Anil Gurnani
> Cc: swig-user@lists.sourceforge.net
> Subject: Re: [Swig-user] Question about wrapping C++ classes to be
returned
> to Python as Python objects
>
>
>
> On Sun, Sep 18, 2011 at 7:32 AM, Anil Gurnani <anil.gurnani@gmail.com>
> wrote:
>
>
>
> The C++ class that I want to return back to Python is contained as an
> instance variable in the CPPClass (actually it?s like a linked list ?
where
> a node has a pointer to another node).
>
>
>
> Can you explain why sometimes you return a wrapped object, and other
times
> you return a float? ?That's the part that makes me think this should be
a
> pure-python method.
>
>
>
> Stefan
>
>



------------------------------

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1

------------------------------

_______________________________________________
Swig-user mailing list
Swig-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user


End of Swig-user Digest, Vol 64, Issue 12
*****************************************

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1

------------------------------

_______________________________________________
Swig-user mailing list
Swig-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user


End of Swig-user Digest, Vol 64, Issue 13
*****************************************

-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1

------------------------------

_______________________________________________
Swig-user mailing list
Swig-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user


End of Swig-user Digest, Vol 64, Issue 14
*****************************************