当前位置:网站首页>Use graalvm native image to quickly expose jar code as a native shared library
Use graalvm native image to quickly expose jar code as a native shared library
2022-07-02 20:03:00 【dalongrong】
Mainly from jgrapht Of capi Learned , Say, tidy up , Later you can use
Reference play
- Code definition
package org.pkg.implnative;
- 1.
import org.graalvm.nativeimage.c.function.CEntryPoint;
- 1.
import org.graalvm.word.Pointer;
- 1.
public final class NativeImpl {
- 1.
@CEntryPoint(name = "Java_org_pkg_apinative_Native_add")
- 1.
public static int add(Pointer jniEnv, Pointer clazz, @CEntryPoint.IsolateThreadContext long isolateId, int a, int b) {
- 1.
return a + b;
- 1.
}
- 1.
}
- 1.
- Generating shared libraries
Use it directly maven plugin It is also a good method
$GRAALVM/bin/native-image --shared -H:Name=libnativeimpl -cp nativeimpl
- 1.
- effect

explain
be based on graalvm We can achieve something like golang Of export Ability , It's very convenient
Reference material
https://www.graalvm.org/reference-manual/native-image/ImplementingNativeMethodsInJavaWithSVM/
https://github.com/jgrapht/jgrapht-capi
边栏推荐
- 良心总结!Jupyter Notebook 从小白到高手,保姆教程来了!
- GCC: Graph Contrastive Coding for Graph Neural NetworkPre-Training
- 分享几个图床网址,便于大家分享图片
- [译]深入了解现代web浏览器(一)
- 【Hot100】22. bracket-generating
- 简书自动阅读
- Notes on hardware design of kt148a voice chip IC
- 【NLP】一文详解生成式文本摘要经典论文Pointer-Generator
- Postman interface test practice, these five questions you must know
- [Chongqing Guangdong education] reference materials for labor education of college students in Nanjing University
猜你喜欢

Yes, that's it!

MySQL function

API文档工具knife4j使用详解

C language linked list -- to be added

KS004 基于SSH通讯录系统设计与实现

Shardingsphere jdbc5.1.2 about select last_ INSERT_ ID () I found that there was still a routing problem

Refactoring: improving the design of existing code (Part 2)
[译]深入了解现代web浏览器(一)

AcWing 1126. Minimum cost solution (shortest path Dijkstra)

【Hot100】21. Merge two ordered linked lists
随机推荐
SQLite 3.39.0 release supports right external connection and all external connection
Postman接口测试实战,这5个问题你一定要知道
Educational codeforces round 129 (rated for Div. 2) supplementary problem solution
KT148A语音芯片ic的用户端自己更换语音的方法,上位机
AcWing 340. Solution to communication line problem (binary + double ended queue BFS for the shortest circuit)
【Hot100】21. 合并两个有序链表
AcWing 903. Expensive bride price solution (the shortest path - building map, Dijkstra)
burp 安装 license key not recognized
[译]深入了解现代web浏览器(一)
使用IDM下载百度网盘的文件(亲测有用)[通俗易懂]
ShardingSphere-JDBC5.1.2版本关于SELECT LAST_INSERT_ID()本人发现还是存在路由问题
PXE installation "recommended collection"
【Hot100】21. Merge two ordered linked lists
How to do interface testing? After reading this article, it will be clear
AcWing 1126. Minimum cost solution (shortest path Dijkstra)
B-end e-commerce - reverse order process
Jetson XAVIER NX上ResUnet-TensorRT8.2速度与显存记录表(后续不断补充)
基于SSM实现网上购物商城系统
Automatic reading of simple books
[NLP] a detailed generative text Abstract classic paper pointer generator