Re: ffi library port to Windows

Enrico Migliore <[email protected]> Thu, 22 Jun 2006 14:23:18 +0200
Newsgroups gmane.comp.java.vm.sablevm.general
Organization -
Message-ID <[email protected]>
Hi Etienne,

 here are the notes regarding the ffi port.

Preface
--------

1. I've downloaded the following source tree:  ctypes-0.9.9.6.tar.gz
    from:   http://starship.python.net/crew/theller/ctypes/

2. Created a new project in MSVC 6.0 and added the following files:
     ./ctypes-0.9.9.6/source/libffi_msvc/ffi.c
     ./ctypes-0.9.9.6/source/libffi_msvc/prep_cif.c
     ./ctypes-0.9.9.6/source/libffi_msvc/types.c
     ./ctypes-0.9.9.6/source/libffi_msvc/win32.c

     The file that configures the source: fficonfig.h, is "hand" 
maintained because MSVC doesn't have the autotools utilities.

3. I've built the source tree with the equivalent of the "-Wall" flag 
and noticed that there are 2 easy-to-fix warnings (type cast)

4. Starting from the tests included in the SableVM, I wrote an automatic 
test suite and tested the types needed by the JNI interface.
    All tests complete successfully.

5. The ffi library has actually two ways of calling a foreign function. 
I've just tested the one you use in SableVM

6. I did not modify a single line of the ffi code.

7. In WIN32, the foreign functions called by the JNI, must be compiled 
with the __stdcall qualifer.
    All other functions though, not called directly by the JNI,  can be 
be compiled with the __cdecl qualifer.
   

licensing & merging
-------------------

1. The win32.c file was written by the ctypes guys, and the license is 
very permissive. Are we supposed to ask for permission for using this file?

2. The only file that needs to be merged  is win32.c. However, there are 
some macros which must be merged too. How can we menage this thing?

3. Should we merge my test suite?



porting SableVM to WIN32
-----------------------------
1. I'm ready to start the port.

 Enrico