当前位置:网站首页>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
边栏推荐
- Start practicing calligraphy
- VBScript详解(一)
- MySQL function
- Development skills of rxjs observable custom operator
- Codeforces Round #771 (Div. 2)(A-C)
- How can testers do without missing tests? Seven o'clock is enough
- AcWing 340. Solution to communication line problem (binary + double ended queue BFS for the shortest circuit)
- [real case] trap of program design - beware of large data
- [Chongqing Guangdong education] reference materials for labor education of college students in Nanjing University
- 分享几个图床网址,便于大家分享图片
猜你喜欢

蓝牙芯片ble是什么,以及该如何选型,后续技术发展的路径是什么

JASMINER X4 1U deep disassembly reveals the secret behind high efficiency and power saving

Introduction to mongodb chapter 03 basic concepts of mongodb

CRM Customer Relationship Management System

外包干了三年,废了...

sql-labs

Implementation of online shopping mall system based on SSM

「 工业缺陷检测深度学习方法」最新2022研究综述

SQLite 3.39.0 release supports right external connection and all external connection

AcWing 903. Expensive bride price solution (the shortest path - building map, Dijkstra)
随机推荐
从20s优化到500ms,我用了这三招
CRM Customer Relationship Management System
esp32c3 crash分析
[real case] trap of program design - beware of large data
After 65 days of closure and control of the epidemic, my home office experience sharing | community essay solicitation
Jetson XAVIER NX上ResUnet-TensorRT8.2速度与显存记录表(后续不断补充)
Dictionaries
八年测开经验,面试28K公司后,吐血整理出高频面试题和答案
B端电商-订单逆向流程
【JS】获取hash模式下URL的搜索参数
[source code analysis] model parallel distributed training Megatron (5) -- pipestream flush
GCC: Graph Contrastive Coding for Graph Neural NetworkPre-Training
疫情封控65天,我的居家办公心得分享 | 社区征文
CRM客户关系管理系统
In the era of consumer Internet, a few head platforms have been born
Share several map bed websites for everyone to share pictures
Refactoring: improving the design of existing code (Part 2)
Kt148a voice chip IC software reference code c language, first-line serial port
【Kubernetes系列】kubeadm reset初始化前后空间、内存使用情况对比
pytorch 模型保存的完整例子+pytorch 模型保存只保存可训练参数吗?是(+解决方案)