From 7fce3006ecd0b670e33c2d3ba123778e79e2e943 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 06 一月 2025 09:18:25 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm |   23 +++++++++++++++++++++--
 1 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
index e373f3b..a3a8867 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
+++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm
@@ -17,7 +17,21 @@
 	{
 
 		PyGILThreadLock lock;
-		PyObject* pModule = create_py_module("${pyModule}.${pyName}");
+
+		jclass hashmapClass = env->FindClass("java/util/HashMap");
+		jmethodID getMID = env->GetMethodID(hashmapClass, "get", "(Ljava/lang/Object;)Ljava/lang/Object;");
+		jstring keyJString = env->NewStringUTF("pyFile");
+		jobject javaValueObj = env->CallObjectMethod(settings, getMID, keyJString);
+		jstring javaStringValue = (jstring)javaValueObj;
+		const char* strValue = env->GetStringUTFChars(javaStringValue, NULL);
+		//*************导入模型******************
+		PyObject* pModule = create_py_module(strValue);
+		// 释放java占用内存
+		env->ReleaseStringUTFChars(javaStringValue, strValue);
+		env->DeleteLocalRef(javaStringValue);
+		env->DeleteLocalRef(javaValueObj);
+		env->DeleteLocalRef(keyJString);
+		env->DeleteLocalRef(hashmapClass);
 		if (pModule == NULL)
 		{
 			cout << "model error" << endl;
@@ -106,7 +120,12 @@
 
 		delete[] pArg;
 		pArg = nullptr;
-		delete pArg;*/
+		delete pArg;
+
+		Py_DECREF(pReturn);
+		Py_DECREF(pFunc);
+		Py_DECREF(pModule);
+		Py_CLEAR(pModule);*/
 
 		return result;
 	}

--
Gitblit v1.9.3