callback return nagetive address

Q&A's, tips, howto's
Locked
dexter
Posts: 74
Joined: Fri Nov 11, 2011 12:55 am

callback return nagetive address

Post by dexter »

I am running newlisp on raspberry pi

Code: Select all

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:

Code: Select all

> (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

Locked