get it to BUILD and RUN

This commit is contained in:
2026-06-02 09:21:51 -03:00
parent 322aa2178c
commit 8c1fc42867
4 changed files with 7 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
CC=gcc CC=gcc
CXX=g++ CXX=g++
CFLAGS=-Wall -Wextra -fno-sanitize=address CFLAGS=-Wall -Wextra
LD_FLAGS=-fno-sanitize=address LD_FLAGS=
TARGET=libcarbon.so TARGET=libcarbon.so
BASE_PATH=./src/main/org/neoflock/NeoNucleus BASE_PATH=./src/main/org/neoflock/NeoNucleus
@@ -32,6 +32,6 @@ run: all
clean: clean:
rm ${JAVA_CLASSES} rm ${JAVA_CLASSES}
rm $(OBJS) $(TARGET) rm $(OBJS) $(BASE_NPATH)/$(TARGET)
.PHONY: all clean .PHONY: all clean

View File

@@ -1,4 +1,4 @@
# Carbon Hydrogen # Carbon Hydrogen
NeoNucleus JNI bindings. NeoNucleus JNI bindings.
### Dev Setup Notes ### Dev Setup Notes
Java expects libcarbon.so on the src/native directory. This is the default unless you're not using the Makefile. Make *sure* to build NeoNucleus with `make lib MODE=release`, and place the libneonucleus.a on src/native. Java expects libcarbon.so on the src/native directory. This is the default unless you're not using the Makefile. Make *sure* to build NeoNucleus with `make lib MODE=release`, and place the libneonucleus.a on src/native. The same applies for TLA (testLuaArch), which must be built with `make MODE=release`.

View File

@@ -1,5 +1,5 @@
package org.neoflock.NeoNucleus; package org.neoflock.NeoNucleus;
public class nn_Computer { public class nn_Computer extends PointerBackedClass {
// TODO // TODO
} }

View File

@@ -1,7 +1,9 @@
#include "org_neoflock_NeoNucleus_NativeBindings.h" #include "org_neoflock_NeoNucleus_NativeBindings.h"
#include <iostream> #include <iostream>
#include "neonucleus.h" #include "neonucleus.h"
extern "C" {
#include "ncomplib.h" #include "ncomplib.h"
}
#include <jni.h> #include <jni.h>
#include "luaarch.h" #include "luaarch.h"
@@ -41,12 +43,9 @@
JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1initContext JNIEXPORT jobject JNICALL Java_org_neoflock_NeoNucleus_NativeBindings_nn_1initContext
(JNIEnv * env, jclass) { (JNIEnv * env, jclass) {
//jclass clazz = env->FindClass("org/neoflock/NeoNucleus/nn_Context");
//jmethodID creator = env->GetStaticMethodID(clazz, "createFromPointer", "(J)Lorg/neoflock/NeoNucleus/Context;");
jobject obj = Carbon::InstantiateOpaqueClass(env, "org/neoflock/NeoNucleus/nn_Context"); jobject obj = Carbon::InstantiateOpaqueClass(env, "org/neoflock/NeoNucleus/nn_Context");
nn_Context * ctx = (nn_Context*)malloc(sizeof(nn_Context)); nn_Context * ctx = (nn_Context*)malloc(sizeof(nn_Context));
nn_initContext(ctx); nn_initContext(ctx);
//jobject result = env->CallStaticObjectMethod(clazz, creator, (jlong) ctx);
Carbon::PointerBacked::SetPointer(env, obj, ctx); Carbon::PointerBacked::SetPointer(env, obj, ctx);
return obj; return obj;
} }