e ai pessoal,
eu estou tentando usar o tal do jna… mas não to conseguindo… peguei um exemplo da internet e já setei o classpath, e talz…mas ele nao encontra a dll… o que sera q ta acontecendo?
la vai o codigo:
esse é o testejna.cpp:
#include <stdio.h>
#include <windows.h>
#include "testejna.h"
void librarymethod(char* whatToSay)
{
printf("Java Rocks, I’m Calling this without JNI and telling the C code to Say: %s !\n",whatToSay);
}
testejna.h:
#ifndef testejna_H
#define testejna_H
void librarymethod(char* whatToSay);
#endif
MySharedLibrary.java:
package testejna;
import com.sun.jna.Library;
public interface MySharedLibrary extends Library{
public void librarymethod(String whatToSay);
}
e TesteJNA.java:
package testejna;
import com.sun.jna.Native;
public class TesteJNA {
public static void main(String args[]){
MySharedLibrary lib = (MySharedLibrary) Native.loadLibrary("testejna", MySharedLibrary.class);
lib.librarymethod("Java Rocks");
}
}
tem gente que ja conseguiu usar isso e diz q eh simples… mas tem algo obscuro ai… hehe