callback return nagetive address

Started by dexter, August 30, 2015, 10:53:07 AM

Previous topic - Next topic

dexter

I am running newlisp on raspberry pi

processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 2.00
Features        : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2708
Revision        : 0010
Serial          : 0000000076c41fce



try to write some codes with callback so that I can use newlisp function in C



but callback gave me nagetive address when I try to do it like this:

> (define (cmp a b) (- (get-int a) (get-int b)))
(lambda (a b) (- (get-int a) (get-int b)))
> (set 'func (callback 'cmp "int" "void*" "void*"))
-1225445368
>


because the address is nagetive so I got segment fault everytime exectued



but this code works well on x86 ,so is this a bug or what?



my newlisp is 10.6.2



thanks