diff --git a/Makefile b/Makefile index bf7d3ae..fb36ea1 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ AR=ar CFLAGS=-Wall -Wextra LD_FLAGS= TARGET=libcarbon.so +MODE=DEBUG BASE_PATH=./src/main/org/neoflock/NeoNucleus JAVA_HOME=/usr/lib/jvm/java-25-openjdk/ @@ -32,7 +33,7 @@ $(TARGET): $(OBJS) src/native/libneonucleus.a $(OBJS) src/native/libneonucleus.a $(TLA_PATH)/foreign/lua54/liblua.a -lc $(LD_FLAGS) %.o: %.cpp - $(CXX) -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux $(CFLAGS) \ + $(CXX) -c -fPIC -I${JAVA_HOME}/include -I${JAVA_HOME}/include/linux $(CFLAGS) -DMODE=$(MODE) \ $< -o $@ java: ${JAVA_CLASSES} diff --git a/src/native/carbon.hpp b/src/native/carbon.hpp index 0f29e94..3b3f5d8 100644 --- a/src/native/carbon.hpp +++ b/src/native/carbon.hpp @@ -14,6 +14,12 @@ NULLPTR_THROW(cname);\ return;\ } +#if MODE == DEBUG +#define CARBON_FIND_CLASS(varn, cname) jclass clazz = env->FindClass(cname);\ + if (clazz == NULL) return NULL; +#else +#define CARBON_FIND_CLASS(varn, cname) jclass clazz = env->FindClass(cname); +#endif // codename for NN JNI is Carbon because i needed something better than NN JNI @@ -52,6 +58,7 @@ namespace Carbon { // typedef nn_Exit (nn_ComponentHandler)(nn_ComponentRequest *request); nn_Exit JNIComponentHandler(nn_ComponentRequest* request); bool CallGC(JNIEnv* env); + } namespace Carbon::Exceptions { CARBON_EXCEPTION_FUNC(ThrowNullPtr, "java/lang/NullPointerException");