Create Java Native methods for constructors
•
Java
I'm writing a program in Java. I want to create a native interface for the library written in C But I'm confused about how to write native method declarations for constructors
Say I have this C class and constructor:
template <class _Tp,class _Val> class Arbitrator { public: Arbitrator(); }
How do I write native method declarations?
This is the package I have made so far HBOT proxy. bwsal. arbitrator;
public class Arbitrator<Tp,Val> { public native Arbitrator Arbitrator(); }
Is that what I did
thank you
Solution
Create a native method For example, private native void init() Call it from a constructor in Java In its JNI implementation, access C classes as needed
You will have to use JNI generated method signatures, so you can't directly map Java classes to C classes if that's what you want to do
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码