Browse Source

HPCC-8541 - Add examples illustrating calling Python, Java, Javascript from ECL

Corrected to use rtlMalloc rather than new char.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 12 years ago
parent
commit
03bf2f9560

+ 1 - 2
initfiles/examples/javascript/jsv8.ecl

@@ -24,7 +24,6 @@ using namespace v8;
     Isolate* isolate = Isolate::New();
     {
         v8::Isolate::Scope iscope(isolate);
-        v8::V8::Initialize();
         // Create a stack-allocated handle scope.
         HandleScope handle_scope;
         Persistent<Context> context = Context::New();
@@ -50,7 +49,7 @@ using namespace v8;
         String::AsciiValue ascii(result);
         const char *chars= *ascii;
         __lenResult = strlen(chars);
-        __result = new char(__lenResult);
+        __result = (char *)rtlMalloc(__lenResult);
         memcpy(__result, chars, __lenResult);
     }
     isolate->Dispose();

+ 1 - 1
initfiles/examples/jni/java_from_ecl.ecl

@@ -135,7 +135,7 @@ static void resolveJNIMethods()
 
     __lenResult = env->GetStringUTFLength(result);
     const char * chars =  env->GetStringUTFChars(result, NULL);
-    __result = new char(__lenResult);
+    __result = (char *)rtlMalloc(__lenResult);
     memcpy(__result, chars, __lenResult);
     env->ReleaseStringUTFChars(result, chars);
 // }

+ 1 - 1
initfiles/examples/python/python_embed.ecl

@@ -122,7 +122,7 @@ public:
      __lenResult = PyString_Size(pResult);
     const char * chars =  PyString_AsString(pResult);
     checkPythonError();
-    __result = new char(__lenResult);
+    __result = (char *)rtlMalloc(__lenResult);
     memcpy(__result, chars, __lenResult);
 }
 ENDC++;

+ 1 - 1
initfiles/examples/python/python_embed2.ecl

@@ -121,7 +121,7 @@ public:
      __lenResult = PyString_Size(pResult);
     const char * chars =  PyString_AsString(pResult);
     checkPythonError();
-    __result = new char(__lenResult);
+    __result = (char *)rtlMalloc(__lenResult);
     memcpy(__result, chars, __lenResult);
 }
 ENDC++;

+ 1 - 1
initfiles/examples/python/python_from_ecl.ecl

@@ -147,7 +147,7 @@ public:
      __lenResult = PyString_Size(pResult);
     const char * chars =  PyString_AsString(pResult);
     checkPythonError();
-    __result = new char(__lenResult);
+    __result = (char *)rtlMalloc(__lenResult);
     memcpy(__result, chars, __lenResult);
 }
 ENDC++;

+ 1 - 1
initfiles/examples/python/python_from_ecl2.ecl

@@ -119,7 +119,7 @@ public:
      __lenResult = PyString_Size(pResult);
     const char * chars =  PyString_AsString(pResult);
     checkPythonError();
-    __result = new char(__lenResult);
+    __result = (char *)rtlMalloc(__lenResult);
     memcpy(__result, chars, __lenResult);
 }
 ENDC++;