[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]

Eshell V5.7  (abort with ^G)
1> ffi:sizeof(uint).
2> erl_ddll:load_library("/tmp", libc, [{preload, [{isupper,

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:

	res = build_preloads_info(p, de->hndl);
	res = build_preloads_info(p, drv->handle);  /* ZVI */

		erts_free(ERTS_ALC_T_DRV, q->drv->driver_name);
		erts_free(ERTS_ALC_T_DRV, q->entry->driver_name);  /* ZVI */

		erts_free(ERTS_ALC_T_DRV, q->drv);
		erts_free(ERTS_ALC_T_DRV, q->entry);  /* ZVI */

	hp = ArithAlloc(p, 1 + 1); 
	hp = HAlloc(p, 1 + 1); /* ZVI */

    hp = ArithAlloc(p, 1 + words_count);
    hp = HAlloc(p, 1 + words_count); /* ZVI */

#define digit_t ErtsHalfDigit          

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


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