pass C struct to java using JNI - SWIG

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pass C struct to java using JNI - SWIG

govind ashrit

Hello All,

How to pass C struct to java using JNI ?

 

E.g. Below Strcut in C

 

typedef struct State_t {

  uint8_t time;

  uint8_t frequecny;

  bool sym;

 

} State_t;

 

 

Java Side  ( Handle function is a callback.)


SyncState_t  is generated Java file by SWIG

 

private void handle(short USN, short ReceiverHandle, short replyStatus, State_t state) {



}


Thanks and Regards
Govind R Ashrit


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

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: pass C struct to java using JNI - SWIG

William S Fulton
SWIG is primarily for calling C/C++ code from other languages like
Java, so you can return a C struct to Java if you call a wrapped C
function from Java. If you want C code to call back into Java via a
callback, then the only real support is the director feature which is
C++ only.

William

On 26 August 2016 at 08:43, govind ashrit <[hidden email]> wrote:

>
> Hello All,
>
> How to pass C struct to java using JNI ?
>
>
>
> E.g. Below Strcut in C
>
>
>
> typedef struct State_t {
>
>   uint8_t time;
>
>   uint8_t frequecny;
>
>   bool sym;
>
>
>
> } State_t;
>
>
>
>
>
> Java Side  ( Handle function is a callback.)
>
>
> SyncState_t  is generated Java file by SWIG
>
>
>
> private void handle(short USN, short ReceiverHandle, short replyStatus,
> State_t state) {
>
>
>
> }
>
>
> Thanks and Regards
> Govind R Ashrit
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> Swig-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/swig-user
>

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user