From 6c2ff1c7c8e0aba3af92110b76687b78f8278e86 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期五, 03 一月 2025 09:57:37 +0800 Subject: [PATCH] 动态数据长度 --- iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm | 17 +++++++++++++++-- 1 files changed, 15 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..ddf78cf 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,15 @@ { 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); + const char* strValue = env->GetStringUTFChars((jstring)javaValueObj, NULL); + + PyObject* pModule = create_py_module(strValue); + /*PyObject* pModule = create_py_module("${pyModule}.${pyName}");*/ if (pModule == NULL) { cout << "model error" << endl; @@ -106,7 +114,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