compiling linked-in driver on Mac OSX

Jacob Vorreuter jacob.vorreuter@REDACTED
Sat May 29 21:55:01 CEST 2010


I'm having trouble compiling and loading the example driver from http://www.erlang.org/doc/tutorial/c_portdriver.html

This is the driver source that I'm using: http://gist.github.com/418491

I'm using the gcc flags mentioned in other posts for compiling and linking on Mac OSX:

$ gcc -o example_drv.so example_drv.c -bundle -flat_namespace -undefined suppress -I/usr/local/lib/erlang/erts-5.7.5/include/

Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
Eshell V5.7.5  (abort with ^G)
1> erl_ddll:load(".", "example_drv").
{error,{open_error,-10}}
2> erl_ddll:format_error({open_error,-10}).
"dlopen(./example_drv.so, 2): no suitable image found.  Did find:\n\t./example_drv.so: mach-o, but wrong architecture"

Any ideas as to why I'm getting this "wrong architecture" error when trying to load the driver?  I'm using R13B04 on Snow Leopard.

Thanks,

Jake


More information about the erlang-questions mailing list