Re: ffi library port to Windows

Etienne Gagnon <[email protected]> Wed, 17 May 2006 10:47:13 -0400
Newsgroups gmane.comp.java.vm.sablevm.general
Message-ID <[email protected]>
This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--===============1545169245==
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature";
	boundary="------------enig34DC573206ACC2C87930C691"

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig34DC573206ACC2C87930C691
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit

Hi Enrico,

Have you given a look at :
 http://ctypes.cvs.sourceforge.net/ctypes/ctypes/source/libffi_msvc/

Apparently, ctypes uses an old version of libffi which they ported to
msvc.  Maybe looking at it could help you.

See below.

Enrico Migliore wrote:
> question
> --------
> ffi_call_STDCALL() is supposed to receive the actual parameters from the
> stack. That means that ffi is only able to jump correctly into C codes
> compiled with the following qualifier:
> 
>                                 __stdcall
> 
> Therefore, all the foreing functions, compiled with the following
> qualifier:
> 
>                                __cdecl
> 
> which is the default for MSVC applications, might not be correctly
> called by the ffi library.
> 
> 
> That Is that ok?

I would guess so.  I think that this might be the reason for the use of
JNICALL macro in the header of JNI functions, e.g.

 JNIEXPORT void JNICALL
 Java_Foo_f(JNIEnv *env, jobject this, jint arg)


In other words, I guess that jni.h should export:

  #define JNICALL __stdcall

under MSVC, and everything will work fine.

See:

 12.4 Constants in:
   http://java.sun.com/docs/books/jni/html/types.html

Have fun!

Etienne
PS:  I've been overloaded, lately, by academic and research community
work.  I should get back in active mode next week.  Thanks for the
patience of all...

-- 
Etienne M. Gagnon, Ph.D.            http://www.info2.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/

--------------enig34DC573206ACC2C87930C691
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEazd3jyrJi4rH84gRAskUAJ9to3Jirtd0eVr+PELF7oNNNd8zVQCeJ9YL
Bz5rWotzJIMj0Vhq1WWxw9w=
=oJLb
-----END PGP SIGNATURE-----

--------------enig34DC573206ACC2C87930C691--


--===============1545169245==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
SableVM-user mailing list
[email protected]
http://sablevm.org/lists/control/listinfo/sablevm-user

--===============1545169245==--