How to use JNAerator with multiple dynamic libraries under one header?

北慕城南 提交于 2019-12-04 11:28:10

JNAerator has an -arch option designed just for that, although the doc is currently terribly vague about it:

java -jar jnaerator-0.12-shaded.jar \
  -arch win32 win32/test.dll \
  -arch win64 win64/test.dll \
  -arch darwin_universal mac/libtest.dylib \
  -arch linux_x86 linux_x86/libtest.so \
  -arch linux_x64 linux_amd64/libtest.so \
  test.h \
  -mode StandaloneJar \
  -jar test.jar

This will bundle the libraries under the format expected by BridJ (see its wiki page about embedded binaries):

unzip -l test.jar gives:

    ...
    0  04-09-15 22:45   lib/win32/test.dll
    0  04-09-15 22:45   lib/win64/test.dll
    0  04-09-15 22:45   lib/darwin_universal/libtest.dylib
    0  04-09-15 22:45   lib/linux_x86/libtest.so
    0  04-09-15 22:45   lib/linux_x64/libtest.so

The library names are currently expected to be exactly lib<name>.(so|dylib) or <name>.dll for every platform, although that could easily be fixed if you ask.

(note: I'm the author of BridJ & JNAerator)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!