Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Declarative Services


While I've not used JNA, I agree that wrapping the native library call in a POJO/proxy that can be the DS component's implementation class would work well.  Good idea Michael.


From: Michael Mangeng <mm@xxxxxx>
To: Equinox development mailing list <equinox-dev@xxxxxxxxxxx>
Date: 11/04/2010 08:42 AM
Subject: Re: [equinox-dev] Declarative Services
Sent by: equinox-dev-bounces@xxxxxxxxxxx





Hi Santiago

Maybe you can create a proxy class which uses a static initializer for this purpose.

e.g.

interface MyInterface {
                public String methodFromInterface(int x);
}

class ProxyClass implements MyInterface {
                private static final MyInterface x = null;
                static {
                                 impl = Native.loadLibrary(<SharedLibrary Name>, MyInterface.class);
                }

                public String methodFromInterface(int x) {
                                 return x.methodFromInterface(x);
                }

}

You could also do a lazy initialization of the c++ code in the constructor or when a method is called.

greetings,
michael


Am 04.11.2010 um 13:32 schrieb Santiago Hurtado Gutierrez:

> Hi Simon Thanks for your quick response,
>
> I want to point out that my IImageSegmentation Object is an interface that is implemented by c++ component called with JNA with the following line
>
> Native.loadLibrary(<SharedLibrary Name>,<InterfaceName>.class)
>
> However in the DS you call only java implementation as far as I now
>
> I now is not suppose to be used like this, but I will like to know if there is any possibility to have the JNA implementation called in the ds
>
> thanks again
> _______________________________________________
> equinox-dev mailing list
> equinox-dev@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/equinox-dev


_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev



Back to the top