3rdshiftcoder -
unread,Mar 4, 2012, 5:19:24 PM3/4/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to haxe...@googlegroups.com
Hi-
Is there anything that jumps off the page that is causing a segmentation fault for my library when i run .n that calls .ndll?
thanks, I read that it is caused by a reference to an object that doesnt get freed.
jim
#define IMPLEMENT_API
#include <C:/Motion-Twin/haxe/lib/hxcpp/2,08,1/include/hx/CFFI.h>
#include<c:/Motion-Twin/haxe/lib/hxcpp/2,08,1/include/hxcpp.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include "vacation.h"
<code haxe>
void myFinalizer(void* abstract_object){
hx::Object *obj = (hx::Object *) abstract_object;
void * np;
np = obj->__GetHandle();
// get the pointer to the native instance
free(np); // free resources
}
value GetServiceContainer(int number ){
printf("%s", "foo_");
vector<Credit> * tier(0);
Credit Street1(104,8,1,200,400); // >=20
Credit Street2(104,8,2,152,304); //11-19
Credit Street3(104,8,3,136,272); //6-10
Credit Street4(70,0,0,70,140); // 1-5
// add rest of tier vacation data
switch(number)
{
case 1: // std::cout << "you will retire in a gated community\n";
break;
case 2: tier->push_back(Street2); //std::cout<<"tier2\n";
break;
case 3: tier->push_back(Street3); //std::cout<<"tier3\n";
break;
case 4: tier->push_back(Street4); //std::cout<<"tier4\n";
break;
default: //std::cout<< "no higher tier in current manual";
break;
}
CAN * molson;
molson = (CAN*) malloc(sizeof(CAN));
molson->beer = tier;
//printf("%d",tier[0]->vAnnual);
value abstract_object = alloc_abstract(myContainer, molson);
val_gc(abstract_object, ((hxFinalizer) &myFinalizer));
return abstract_object;
}
</code>