libffi-d: D binding to libffi
    Alex Rønne Petersen 
    xtzgzorex at gmail.com
       
    Thu Dec  8 11:10:48 PST 2011
    
    
  
Hi folks,
Since I needed a way to call arbitrary C functions dynamically (while 
knowing their pointer + signature), I decided to write a binding to 
libffi for D.
https://github.com/lycus/libffi-d
There is heavy focus on simplicity: It is composed of 3 enums (FFIType, 
FFIStatus, FFIInterface), one alias (FFIFunction), and one function 
(ffiCall). The API is fairly self-describing, so I haven't really spent 
a whole lot of time on docs. For examples, see the tests sub-directory 
(please also read 'info libffi').
Known limitations:
* No access to the closure API.
* No access to the 'raw' API (which is undocumented in libffi anyway).
Known issues:
* Detection of soft float ABIs is not currently done (due to limitations 
in most D compilers).
* ABI overriding for some rare Unix ABIs is not currently possible.
* Currently no good way to actually use the library on Windows. Anyone 
who knows their stuff about DMD and DLLs on Windows, please do 
contribute. ;)
If you run into any issues, please throw a test case at the GitHub issue 
tracker and I'll look into it. Enjoy!
- Alex
    
    
More information about the Digitalmars-d-announce
mailing list