[CCC DEV] FFI

Carl Ritson C.G.Ritson at kent.ac.uk
Tue Mar 13 08:39:17 GMT 2012


Hi Mathias,

> I have problems calling a function form the foreign function interface.
>
> <snip>

At a quick look your code seems fine.

> I've followed the example of the nxt wrapper. In a paper about the FFI
> another naming convention was mentioned, without the "tvmspecial.0" yet in
> another paper a leading "__" is mentioned.

There are two schemes: the 'C.tvmspecial.' for FFI functions that are
built in to the TVM binary and the 'C.' scheme for FFI functions in
dynamic linked libraries.

> Anyway none of these naming conventions seem to work.
> Am I overlooking something?

What is your observed behaviour?
Have you linked your FFI functions in to the TVM binary and put your
sffi_table in to the ECTX?

See tvm/posix/sffi.c line 82:
  void install_sffi (ECTX ectx)
  {
        ectx->sffi_table        = sffi_table;
        ectx->sffi_table_length = sizeof(sffi_table) / sizeof(SFFI_FUNCTION);
  }

Cheers,

Carl



More information about the developers mailing list