Bug with callbacks returning a signed long long

Luis Oliveira <[email protected]> Wed, 02 Nov 2005 17:27:41 +0000
Newsgroups gmane.lisp.openmcl.bugs
Message-ID <[email protected]>
Hello,

While writing tests for CFFI's long long support, I came across the
following bug when returning signed long long types from callbacks:

$ cat testlib.c 
#include <stdio.h>
#include <limits.h>

void expect_long_long(long long (*f)(long long))
{
   printf("f(-42LL) => %lld\n", f(-42LL));
}
$ gcc -o testlib.dylib -bundle -lm -Wall -std=c99 -pedantic testlib.c
$ openmcl
Welcome to OpenMCL Version 1.0 (DarwinPPC32)!
? (open-shared-library "testlib.dylib")
#<SHLIB testlib.dylib #x83DB606>
? (defcallback return-llong (:signed-doubleword n :signed-doubleword)
  (format t "Lisp side got: ~A~%" n)
  -42)
RETURN-LLONG
? (external-call "_expect_long_long" :address return-llong)
Lisp side got: -42
> Error in process listener(1): value #<A Mac Pointer #xF0135B88> is not
> of the expected type CCL::UVECTOR.
> While executing: CCL::%%SET-SIGNED-LONGLONG
> Type :POP to abort.
Type :? for other options.
1 >

The same test using "unsigned long long" works as expected.

BTW, is there any particular reason why the :long-long,
:signed-long-long and :unsigned-long-long are undefined?

-- 
Luís Oliveira
luismbo (@) gmail (.) com
Equipa Portuguesa do Translation Project
http://www.iro.umontreal.ca/translation/registry.cgi?team=pt

_______________________________________________
Bug-openmcl mailing list
[email protected]
http://clozure.com/mailman/listinfo/bug-openmcl