celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Michael <brian_michael...@yahoo.com.INVALID>
Subject RE: Structs to Java
Date Sun, 17 May 2020 02:20:44 GMT
Ok. I managed to figure this out. To get a class to pass over you can’t have it inside your
interface In Java but just inside your package and outside of your interface. Doing thus changes
how it is passed and you’ll get a descriptor file call of “package name”/“class name”
thus changing the $ to a / and being processed normally. 

On 2020/05/13 20:09:11 Brian Michael wrote:
> Hello,
> 
> I was looking to get some assistance in passing a struct to Java via the RSA. I get that
you need to setup a class on the java end to mimic your C struct but I can’t seem to get
the descriptor file to work with what I’ve got. 
> 
> Java Interface is named RemoteExample inside package org.apache.celix
> 
> class complex_input_example2 {
> public double a;
> public double b;
> public int n;
> public String name;
> }
> 
> class complex_output_example2 {
> public double pow;
> public int fib;
> public String name;
> }
> 
> complex_output_example2 setComplex2(complex_input_example2 exmpl);
> 
> In C I have:
> 
> struct complex_input_example2 {
> double a;
> double b;
> int32_t n;
> char* name;
> };
> 
> struct complex_output_example2 {
> double pow;
> int32_t fib;
> char* name;
> };
> 
> struct remote_example {
> void* handle;
> int (*setComplex2)(void* handle, complex_input_example2* exmpl,
> complex_output_example2 **out);
> };
> 
> 
> //Example.descriptor
> :header
> type=interface
> name=org.apache.celix.RemoteExample
> version=1.0.0
> :annotations
> classname=org.apache.celix.RemoteExample
> :types
> complex_input_example2={DDNt a bn name}
> complex_output_example2={DNt pow fib name}
> :methods
> setComplex2(Lorg/apache/celix/RemoteExample.complex_input_example2;)Lorg/apache/celix/RemoteExample.complex_output_example2;=setComplex2(#am=handle;PLcomplex_input_example2;#am=out;*Lcomplex_output_example2;)N
> 
> Debugging out what the descriptor wants seems to yield:
> setComplex2(Lorg/apache/celix/RemoteExample$complex_input_example2;)Lorg/apache/celixRemoteExample$complex_output_example2;
> 
> Error says “Cannot find method with sig” the above string. However if I put the $
in the descriptor then it just errors out and won’t load the descriptor. 
> 
> Thanks,
> Brian
> 
> Sent from my iPhone
> 
> 
> Sent from my iPhone


Sent from my iPhone

Mime
View raw message