Ok i've reproduced (for those not on the haXe list - orginal problem
outlined at bottom of the mail) . I've narrowed the problem down
also, simply calling
val_print();
Will give the error also. I include full sources below, but if you
want me to run ay further debugging myself, please can you give me
command line details of what to do - im not a c expert - and im not
sure how i would capture a gdb trace from within neko...?
My googles on this subject bring up nearly exclusive mac issues, so i
think your correct in assuming its mac only. And seems to be an
issue with the child process not having access to the neko memory
space, so may just be a case of adding a gcc option, but thats beyond
my knowledge. The example code, just spawns a child process then goes
into an infinite loop, which i had to otherwise the parent process
exits b4 the child can complete...
/*
* bus_error.c
* nekoError
*
* Created by Pete Hobson on 08/01/2007.
* Copyright 2007 __MyCompanyName__. All rights reserved.
*
*/
#include <neko.h>
#include <neko_vm.h>
#include <pthread.h>
#include <stdio.h>
#include "bus_error.h"
/* function to be executed by the new thread */
void* do_loop(void* data)
{
printf ("Thread I/O\n");
value f =alloc_string("Should crash");
val_print( f );
printf ("complete Thread I/O\n");
}
value begin() {
value f =alloc_string("Shouldnt crash");
val_print( f );
pthread_t writer_id;
pthread_create (&writer_id, NULL, do_loop, NULL);
//CFRunLoopRun();
while(TRUE);
return alloc_string("Hello world");
}
DEFINE_PRIM(begin,0); // function test with 0 arguments
--------cut
//App.hx
class App {
static function main() {
trace(p());
}
private static var p = neko.Lib.load("nekoError","begin",0);
}
-----cut
//terminal output
neko error.n
Shouldnt crashThread I/O
Bus error
Hi All,
Im attempting to callback a Haxe function from a Neko C extension
Im using the code as in the example
value set_handler( value f ) {
val_check_function(f,1); // checks that f has 1 argument
function_storage = alloc_root(1);
*function_storage = f;
}
then to call the function
val_call1(*function_storage,alloc_string("Call Back Haxe"));
This is working fine in normal use, however I have a worker thread
spawned, and if i try executing the callback from there i get a bus
error
This in on OSX 1.4 BTW
Does anything obvious occur to anyone?
Nothing seems wrong here, but we already had some issues with the GC on
Mac/Intel. Is the problem 100% reproductible ? Try using gdb or
something similar to get a stack trace (after recompiling neko with -g).
Also, maybe this kind of message is more appropriate on the Neko list ;)
Nicolas
Pete Hobson
Interaction Developer
[EMAIL PROTECTED]
+44 208 123 6974
--
Neko : One VM to run them all
(http://nekovm.org)