Yet Another Native Loader for the JVM.

Overview

yanl - yet another native loader

Yet another Native library extractor/loader for the JVM, written in Kotlin.

why

other libraries simply don't fit my needs and/or aren't as expandable/configurable as I'd like.

how use

this is going to go over how to setup yanl on a gradle project using a Kotlin DSL buildscript.

first you need to import the library, you can either import it from the maven central repository or from jitpack automatic builds.

for maven central, just add yanl to your dependencies block:

// change to the latest version
val YANL_VERSION = "1.0.0" 

dependencies {
    implementation("fr.stardustenterprises:yanl:$YANL_VERSION")
}

for jitpack, add the repository as well as the dependency, this time using the github domain:

// change to the latest github release, commit, or branch name
val YANL_RELEASE = "1.0.0" 

repositories {
    maven("https://jitpack.io")
}

dependencies {
    implementation("com.github.stardust-enterprises:yanl:$YANL_RELEASE")
}

how work

this library can act as a simple drop-in replacement to your standard System.load or System.loadLibrary.

consider the following example:

public class Program {
    public static void main(String[] args) {
        // requires the native file to be in path
        System.loadLibrary("coollib");
        
        // do stuff
        // ...
    }
}

this would require the library file to be somewhere on the PATH of the operating system.

one way of getting around this problem would be to extract the library from the jar archive to a known folder, then to load it. this approach works but also requires to extract and load the correct library for your processor architecture and operating system.

this is when yanl comes into play.

yanl takes care of platform detection, library extraction and location.

taking back that previous example:

import fr.stardustenterprises.yanl.loader.NativeLoader;

public class Program {
    public static void main(String[] args) {
        // load the library using yanl's default loader
        NativeLoader.getDefault().loadLibrary("coollib");
        
        // do more stuff 
        // ...
    }
}

this time yanl will handle everything according to the NativeLoader default settings.

you can of course change those setting by creating yourself a loader instance:

// library not done, example snippet not available, check back later!

licensing

this project is under the MIT license.

You might also like...
🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)
🚟 Lightweight, and simple scheduling library made for Kotlin (JVM)

Haru 🚟 Lightweight, and simple scheduling library made for Kotlin (JVM) Why did you build this? I built this library as a personal usage library to h

A injection minecraft cheat using jvm attach api

Luminous A injection minecraft cheat using jvm attach api Website: https://lumi.getfdp.today Build We used a thing called Wrapper to make development

A Template for a Github Actions Pipeline for building and publishing Gradle-JVM Applications

github-actions-cd-template-jvm A Template for a Github Actions Pipeline for building and publishing Gradle-JVM Applications It build a executable shad

Yaspeller-kt - Asynchronous Yandex.Speller API wrapper for Kotlin/JVM.

yaspeller-kt Asynchronous Yandex.Speller API wrapper for Kotlin/JVM. Installation repositories { maven { url 'https://jitpack.io' }

Port immer for kotlin/jvm
Port immer for kotlin/jvm

1. kimmer Port https://github.com/immerjs/immer for kotlin/jvm (requires kotlin 1.5+). Immer is the winner of the "Breakthrough of the year" React ope

Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)
Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)

storyblok-mp-SDK-blog ... a showcase of using the Storyblok Kotlin Multiplatform Client to build a blog application (Android, JVM) What's included 🚀

Solves the audit needs for any JVM based application
Solves the audit needs for any JVM based application

Auditor-v1 Solves the audit needs for any JVM based application.

A property/method accessor library for the JVM, written in Kotlin

unlok - unlock your JVM a property/method accessor library for the JVM, written in Kotlin. how to import you can import unlok from maven central just

fusion4j - declarative rendering language for the JVM based on Neos.Fusion

fusion4j - declarative rendering language for the JVM based on Neos.Fusion Supports the Neos Fusion syntax/semantic as described in the official Neos

Comments
  • x86 arch should be alias for i686

    x86 arch should be alias for i686

    I tried creating the gradle-rust-example and whilst it worked on Windows with a 64-bit Java, trying to run the created jar with the 32-bit Adoptium JDK on Windows failed with the library not being found. In Adoptium on Windows, the system property os.arch is "x86". This also seems to be true for 32-bit Windows Zulu JDK builds. When I looked in the jar created for gradle-rust-example, it had packed the Windows 32-bit binary in an i686 directory. When I manually changed this to x86 the jar worked correctly with Adoptium 32-bit JDK on Windows. So I would suggest that x86 is made to be an alias of i686 and so look in the i686 directory.

    opened by mwhapples 7
Owner
Stardust Enterprises
Leading F/OSS projects, one repo at a time.
Stardust Enterprises
Yet another booru viewer for Android

Yet another booru imageboards viewer for Android Download Preview Click Here Building You can build this app just like any other flutter app, for exam

Nauval Rizky 129 Jan 4, 2023
Yet another advanced Craftfting Table mod. My entry for ModFest: Singularity

Crafting Bench A utility mod that adds a custom crafting table with semi-automatic crafting. Features For a complete list of features please check the

Luca Argolo 2 Aug 23, 2022
Run Kotlin/JS libraries in Kotlin/JVM and Kotlin/Native programs

Zipline This library streamlines using Kotlin/JS libraries from Kotlin/JVM and Kotlin/Native programs. It makes it possible to do continuous deploymen

Cash App 1.5k Dec 30, 2022
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Target 5 Dec 8, 2022
🎑 Up to date IANA timezone database library for Kotlin (JVM, JS, Native)

?? IANA Timezone Library for Kotlin Multiplatform Up to date IANA timezone database library for Kotlin (JVM, JS, Native) Usage import org.noelware.ian

Noelware 3 Jun 18, 2022
Simple(vanilla) yet 'Do it all' place picker for your place picking needs in Android

Vanilla Place Picker Vanilla Place Picker provides a UI that displays an interactive map to get the place details and Autocomplete functionality, whic

MindInventory 115 Dec 21, 2022
Main goal of this project is to find the best route from one country to another

Route-service Main goal of this project is to find the best route from one country to another. Data is presented as json format. I've implemented A* p

Teyyihan Aksu 4 Aug 2, 2022
A pair of applications provide a direct means of integrating with one another via application programming interfaces (APIs)

What is a native integration? It's when a pair of applications provide a direct means of integrating with one another via application programming interfaces (APIs). Once integrated, data can flow between the apps and become more readily available to your employees.

Behruz Hurramov 2 Jan 17, 2022
🔴 A non-deterministic finite-state machine for Android & JVM that won't let you down

HAL is a non-deterministic finite-state machine for Android & JVM built with Coroutines StateFlow and LiveData. Why non-deterministic? Because in a no

Adriel Café 73 Nov 28, 2022
:blowfish: An Android & JVM key-value storage powered by Protobuf and Coroutines

PufferDB PufferDB is a âš¡ key-value storage powered by Protocol Buffers (aka Protobuf) and Coroutines. The purpose of this library is to provide an eff

Adriel Café 94 Dec 7, 2022