4
$\begingroup$

It's a bit surprising to me that no one asks about this so far, so let me step up :) .

In version 13.3, an EXPERIMENTAL Foreign Function Interface has been introduced. I'm by no means a C expert, but reading the corresponding document and Stephen's blog, I have a feeling that Foreign Function Interface seems to be the successor of LibraryLink: both are for loading C library, but the former looks much easier to use.

Is my understanding correct? If not, what's the disadvantage/limitation of Foreign Function Interface comparing with LibraryLink?

$\endgroup$
8
  • $\begingroup$ Have you seen this repo? github.com/chriswolfram/ForeignFunctionInterface $\endgroup$
    – Silvia
    Commented Apr 7 at 8:15
  • 2
    $\begingroup$ I'm definitely a less C expert than you, so please take my word as random chat. FFI, by doc page, obviously supports more flexible types than LibraryLink. Also, by personal experience, FFI seems to suffer less runtime overhead than LibraryLink. But surely EXPERIMENTAL is EXPERIMENTAL for a reason. I would always stick to LibraryLink when building product level code until the EXPERIMENTAL tag is removed. $\endgroup$
    – Silvia
    Commented Apr 7 at 8:41
  • 1
    $\begingroup$ I suggest listening to Live CEOing #675. In the beginning, Christopher explains some of the main differences between LibraryLink and ForeignFunction. $\endgroup$
    – Domen
    Commented Apr 7 at 9:48
  • 1
    $\begingroup$ Hm. Maybe it is to strip away other language specifics. I think Christopher tries to use a single interface for all languages that can produce dynamic libraries. Nonetheless, I would guess that most languages that will acually be used for this will have C as common denominator. $\endgroup$ Commented Apr 7 at 12:47
  • 2
    $\begingroup$ I have open a dedicated chatroom here $\endgroup$
    – andre314
    Commented Apr 7 at 16:03

0