Discuss: Erlang Foreign Function Interface (FFI) - Introduction

26 views
Skip to first unread message

Joel Reymont

unread,
Dec 13, 2008, 2:16:21 PM12/13/08
to thinkerlang

Justin Sheehy

unread,
Dec 13, 2008, 3:48:35 PM12/13/08
to think...@googlegroups.com
On Sat, Dec 13, 2008 at 2:16 PM, Joel Reymont <joe...@gmail.com> wrote:
>
> http://thinkerlang.com/2008/02/16/erlang-ffi-introduction.html

Nice clean article on port drivers, Joel. If someone needs to use a C
library in Erlang, they could do much worse than to start with your
introduction.

Given the proliferation of Java frameworks, application servers, and
other such piles of stuff, an introduction to Erlang-native
communication with non-Erlang processes might also benefit from
including a mention of Jinterface.

-Justin

Joel Reymont

unread,
Dec 13, 2008, 3:59:35 PM12/13/08
to think...@googlegroups.com
Justin,

On Dec 13, 2008, at 8:48 PM, Justin Sheehy wrote:

> Nice clean article on port drivers, Joel. If someone needs to use a C
> library in Erlang, they could do much worse than to start with your
> introduction.

Thank you!

> Given the proliferation of Java frameworks, application servers, and
> other such piles of stuff, an introduction to Erlang-native
> communication with non-Erlang processes might also benefit from
> including a mention of Jinterface.


Would you like to write an article for the journal?

Thanks, Joel

--
http://wagerlabs.com

Stackingit_Steve

unread,
Dec 15, 2008, 4:27:00 PM12/15/08
to thinkerlang
For anyone trying to follow the tut using c++, don't forget that C and
C++ decorate their externs differently and Erl is expecting a C style
export.

ie if you check it out with depends ( www.dependencywalker.com/ ) then
you will see the Driver Init method looking like this
driver_init@@YAPAUerl_drv_entry@@PAUTWinDynDriverCallbacks@@@Z, but
you really want the C style export looking like this driver_init

If you don't know how, then simply wrap up your Init method as such :

extern "C" {
DRIVER_INIT(example_drv) /* must match name in driver_entry */
{
return &example_driver_entry;
Reply all
Reply to author
Forward
0 new messages