terminate called after throwing an instance of 'Dynamic'

99 views
Skip to first unread message

Tiger Chan

unread,
Jun 13, 2017, 11:00:44 AM6/13/17
to Haxe
hxcpp version:3,4,64
compiler: mingw

Haxe as library:
package com.gigateam.world;

class World {
public static function main() {
}
public function new() 
{
//new debugger.Local(true);
}
public static function testUnmanagedData():Int{
var array:Array<cpp.UInt8> = [];
var o : cpp.UInt8 = 16;
var ptrU8 : cpp.Pointer<cpp.UInt8> = cpp.Pointer.addressOf( o );
var ptr : cpp.RawPointer<cpp.UInt8> = ptrU8.get_raw();
cpp.NativeArray.setUnmanagedData(array, ptrU8, 1);
return 2;
}
}

Larger c++ code:
using namespace std;

#include "com/gigateam/world/World.h"

extern "C" const char *hxRunLibrary();
extern "C" void hxcpp_set_top_of_stack();

int main(int argc, char* argv[])
{
hxcpp_set_top_of_stack();
  const char *err = hxRunLibrary();
if (err) {
// Unhandled exceptions ...
fprintf(stderr, "Error! %s\n", err );
return -1;
}
printf("ready\n");
int result = ::com::gigateam::world::World_obj::testUnmanagedData();
printf("success\n");
}



gdb result:
ready
terminate called after throwing an instance of 'Dynamic'
[Inferior 1 <process 4044> exit with code 03]


This is my first c++ project (I used to call old-style func like strcpy, printf), maybe I miss couple basic step?

Tiger Chan

unread,
Jun 14, 2017, 5:53:47 AM6/14/17
to Haxe
I have found some discussion about this issue, seems fixed at some version between 3.3.0 and 3.4.2.
Just updated Haxe 3.4.2 and error gone.

But I still don't know how to debug this kind of error

Tiger Chan於 2017年6月13日星期二 UTC+8下午11時00分44秒寫道:
Reply all
Reply to author
Forward
0 new messages