[erlang-questions] State of the Union: FFI

Zvi exta7@REDACTED
Wed Apr 15 19:32:41 CEST 2009


Hi Franco,

I got to the point where it's compiling.
For some reason the erl_ddll.erl didn't built by make clean (probably
prebuilt), so I did:

cd /usr/local/lib/erlang/lib/kernel-2.13  
erlc -I ./include -o ./ebin ./src/erl_ddll.erl

but FFI still doesn't work:

Erlang R13A (erts-5.7) [source] [rq:1] [async-threads:0] [hipe]
[kernel-poll:false]

Eshell V5.7  (abort with ^G)
1> ffi:sizeof(uint).
4
2> erl_ddll:load_library("/tmp", libc, [{preload, [{isupper,
{sint,sint}}]}]).
{error,{open_error,-12}}
3>

I tried to generate a diff against your zip, but it generates to many
changes b/c you included all the i386-apple-darwin9.6.0 stuff).
There is no ArithAlloc macro in R13A, so I changed it to HAlloc.
There is digit_t type in R13A so I defined it as ErtsHalfDigit   (typedef
Uint16 digit_t;)
Fortunattely there not too much changes:


beam/erl_bif_ddll.c:833:
	res = build_preloads_info(p, de->hndl);
CHANGED_TO:
	res = build_preloads_info(p, drv->handle);  /* ZVI */

beam/erl_bif_ddll.c:1790
		erts_free(ERTS_ALC_T_DRV, q->drv->driver_name);
CHANGED_TO:
		erts_free(ERTS_ALC_T_DRV, q->entry->driver_name);  /* ZVI */

beam/erl_bif_ddll.c:1791
		erts_free(ERTS_ALC_T_DRV, q->drv);
CHANGED_TO:
		erts_free(ERTS_ALC_T_DRV, q->entry);  /* ZVI */

beam/erl_bif_ffi_endianness.h:185
	hp = ArithAlloc(p, 1 + 1); 
CHANGED_TO:
	hp = HAlloc(p, 1 + 1); /* ZVI */

beam/erl_bif_ffi_endianness.h:207
    hp = ArithAlloc(p, 1 + words_count);
CHANGED_TO:
    hp = HAlloc(p, 1 + words_count); /* ZVI */

beam/erl_bif_ffi_endianness.h:36
ADDED:
#define digit_t ErtsHalfDigit          


Can you prepare a clean diff against R13A sources?
Maybe Alceste will help us.

BR,
Zvi






Franco Milicchio-4 wrote:
> 
> I have started porting the patch to R13A, although I can't say if it  
> really works: it doesn't compile! Makefile error, not a C one :)
> 
> You may find the source code at:
> http://plm.dia.uniroma3.it/milicchio/public/otp_src_R13A-ffi.zip 
>   (62 MB)
> 
> 
> I have no time left today, but if we all start figuring out what's  
> wrong with it, we may end up having the FFI working on this new  
> release. I have marked the C code with comments (/* FFI START */ and / 
> * FFI END */) where I had doubts about applying Alceste's patch, so it  
> should be easy to spot them.
> 
> By the way, no news about the reason FFI hasn't been taken into  
> account yet?
> 
> Cheers!
> 
> -- 
> Franco Milicchio <fmilicchio@REDACTED>
> 
> DIA - Dept. of Computer Science and Engineering
> University Roma Tre
> http://plm.dia.uniroma3.it/milicchio/
> 
> 
>  
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 



-- 
View this message in context: http://www.nabble.com/State-of-the-Union%3A-FFI-tp22824174p23063501.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list