Fixes the classifer in usage in README Signed-off-by: Tao He sighingnow@gmail.com
Fixes the classifer in usage in README
Signed-off-by: Tao He sighingnow@gmail.com
Basically, fastFFI has three components:
An FFI application must include ffi and llvm4jni-runtime in its class path as runtime dependency.
ffi
llvm4jni-runtime
Checkout source code
git clone <path-to-fastffi> fastffi
Prepare building environment
export LLVM11_HOME=<path-to-llvm-11>
LLVM11_HOME should point to the home of LLVM 11. In Ubuntu, it is at /usr/lib/llvm-11. Basically, the build procedure the following binary:
LLVM11_HOME
/usr/lib/llvm-11
$LLVM11_HOME/bin/clang++
$LLVM11_HOME/bin/ld.lld
$LLVM11_HOME/lib/cmake/llvm
Use fastFFI with Maven.
<properties> <fastffi.revision>0.1.2</fastffi.revision> </properties> <dependencies> <!-- The FFI annotation --> <dependency> <groupId>com.alibaba.fastffi</groupId> <artifactId>ffi</artifactId> <version>${fastffi.revision}</version> </dependency> <!-- The FFI annotation processor for code generation --> <dependency> <groupId>com.alibaba.fastffi</groupId> <artifactId>annotation-processor</artifactId> <version>${fastffi.revision}</version> </dependency> <!-- The runtime component of LLVM4JNI --> <dependency> <groupId>com.alibaba.fastffi</groupId> <artifactId>llvm4jni</artifactId> <version>${fastffi.revision}</version> <classifier>${os.detected.classifier}</classifier> </dependency> <dependency> <groupId>com.alibaba.fastffi</groupId> <artifactId>llvm4jni-runtime</artifactId> <version>${fastffi.revision}</version> </dependency> </dependencies> <plugins> <plugin> <groupId>kr.motd.maven</groupId> <artifactId>os-maven-plugin</artifactId> <version>1.7.0</version> <executions> <execution> <phase>initialize</phase> <goals> <goal>detect</goal> </goals> </execution> </executions> </plugin> </plugins>
Use maven to build your applications.
The generated code, including Java and C++ code, is available in <project.dir>/target/generated-source/annotations
<project.dir>/target/generated-source/annotations
A Java programming language compiler must support standard options in the format -Akey[=value]. fastFFI provides the following options:
-Akey[=value]
fastffi.handleException
false
fastffi.manualBoxing
new Integer()
new Long()
true
Integer.valueOf
Long.valueOf
fastffi.strictTypeCheck
fastffi.nullReturnValueCheck
fastffi.cxxOutputLocation
CLASS_OUTPUT
SOURCE_OUTPUT
NATIVE_HEADER_OUTPUT
fastffi.traceJNICalls
fastffi.compactFFINames
Usage:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> <configuration> <compilerVersion>${javac.target}</compilerVersion> <source>${javac.target}</source> <target>${javac.target}</target> <compilerArgs> <arg>-Afastffi.strictTypeCheck=true</arg> </compilerArgs> </configuration> </plugin>
Install a JDK (JDK 8 and 11)
Install LLVM 11, Maven and CMake
brew install llvm@11 cmake maven
Set ENV
export LLVM11_HOME=/usr/local/opt/llvm@11
TBA
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
fastFFI: Modern and Efficient FFI for Java and C++
Basically, fastFFI has three components:
An FFI application must include
ffiandllvm4jni-runtimein its class path as runtime dependency.Build
Checkout source code
Prepare building environment
LLVM11_HOMEshould point to the home of LLVM 11. In Ubuntu, it is at/usr/lib/llvm-11. Basically, the build procedure the following binary:$LLVM11_HOME/bin/clang++$LLVM11_HOME/bin/ld.lld$LLVM11_HOME/lib/cmake/llvmUse fastFFI with Maven.
Use maven to build your applications.
The generated code, including Java and C++ code, is available in
<project.dir>/target/generated-source/annotationsOptions
A Java programming language compiler must support standard options in the format
-Akey[=value]. fastFFI provides the following options:fastffi.handleException: whether generating code to handle C++ exceptionsfalsefastffi.manualBoxing: usingnew Integer()ornew Long()to box a primitive integer.trueInteger.valueOforLong.valueOf, which cannot be properly handled by the escape analysis of C2 compiler.fastffi.strictTypeCheckfalsefastffi.nullReturnValueChecktruefastffi.cxxOutputLocationCLASS_OUTPUTCLASS_OUTPUT,SOURCE_OUTPUT,NATIVE_HEADER_OUTPUT.fastffi.traceJNICallsfalsefastffi.compactFFINamestrueUsage:
Build Mac OS
Install a JDK (JDK 8 and 11)
Install LLVM 11, Maven and CMake
Set ENV
FAQ
TBA