Is it possible to program plugins in C++

Discussion in 'Plugin Development' started by WhosDaMan, Aug 8, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    WhosDaMan

    Title says it all, didn't find anything of use with the search function.
     
  2. Offline

    Sagacious_Zed Bukkit Docs

    Possible but why bother, JNI is really not the best thing in the world.
     
  3. Offline

    Courier

    JNI is actually pretty good.

    There will be a bit of overhead with each call, so you want to batch operations into few calls.

    You plugin still needs to be in Java, but it can interface with native code.
    Not completely sure of the syntax because it's been awhile, but I think it is something like this:
    Code:java
    1. static
    2. {
    3. //assumes there in a file called libmynativecode.so in this program's executing directory
    4. System.loadLibrary("mynativecode");
    5. }
    6. ...
    7.  
    8. //native declarations
    9. public native float nativeMethod(int num1, int num2);
    10. public native float nativeMethod2(int num1, String str);

    Put these in a class somewhere, then run javah on it to get the native headers.
     
Thread Status:
Not open for further replies.

Share This Page