__builtin_return, __builtin_apply available ?

30 Jan 2011

C/C++ novice question:

Are the builtin functions builtin_return and builtin_apply available ? Did I just miss a header file ? I am trying to compile a small program (not mine, blindly chasing compilation errors) that requires them.

Thanks

31 Jan 2011

The compiler is ARM's RVCT, it does not support (most) GNU extensions. Can you paste the code that's giving you trouble?

31 Jan 2011

Thanks.

It can be found at http://piumarta.com/software/lysp/

" LYSP: a tiny, lightweight Lisp interpreter closely following the tradition of the earliest implementations" ... "Compiled on x86 with gcc -Os it's about 17 KB for the interpreter and 4 KB the garbage collector "

Up front of lysp.c (using the included garbage collector), I added

  1. include "mbed.h"
  2. include "gc.h"
  3. include "stdarg.h"
  4. include "string.h"
  5. include "ctype.h"
  6. include "errno.h"

and an implementation of strdup from http://leithal.cool-tools.co.uk/sourcedoc/mysql509/html/bdb_2clib_2strdup_8c-source.html

There were then two main compilation problems, sofar

1) lack of the builtins 2) A value of type "void *" cannot be assigned to an entity of type "void "

31 Jan 2011

These functions are described here. They are used for dynamic function calls - and they are not available on the ARM compiler :(

Google finds libffi and ffcall as possible solutions for replacing this, but it might need some work to get this used. Maybe you can try to ring Ian Piumarta and ask him for a non-gcc solution...

If you are successful - please post your solution, I would be very interested in a LISP environment on the mbed.

As of your problem #2 - I think it is just that the compiler doesn't know about these functions, and then automatically assumes they are of type void.