[Mono-list] P/Invoke on amd64 was :Marshalling problems

James Fitzsimons james.fitzsimons@gmail.com
Sat, 12 Feb 2005 22:04:54 +0000


--=-9uFeqiIVMdg8Va705SGW
Content-Type: multipart/mixed; boundary="=-OpE61l0MD/YJ2hJPrXrv"


--=-OpE61l0MD/YJ2hJPrXrv
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi Jonathan,

On Sat, 2005-02-12 at 16:47, Jonathan Pryor wrote:
> > libhighgui.so is located in /usr/local/lib. This should be fine however
> > as according to this http://www.jprl.com/interop.html#library-linux if
> > your target library is in /etc/ld.so.cache P/Invoke should find it.
>=20
> I know what it says; I wrote it. =20
Sorry, my bad. I didn't catch that when I wrote my reply!

> I also know that I have virtually zero
> knowledge or experience with mixed 64-bit/32-bit platforms, which
> Linux/Amd64 is.  Consequently, my guide is somewhat lacking, if only
> because I don't know everything. :-)
Fair enough, I can't blame you for that ;-)  To be honest, I haven't notice=
d much=20
difference at all between my 64 linux environment and my 32 bit enviroment.=
 Most
things are still in the same place and work exactly as they did under a
32bit environment.

> I have heard that there are /lib64 directories that are searched for 64-
> bit libraries, but that's about it.  Not having an AMD64 platform of my
> own, it's hard to test for anything else.
There is a /lib64 directory, but on my system there is a symlink from /lib =
to=20
/lib64 so it looks just like a normal 32 bit system.

> So as an experiment, try writing a C program which uses that library,
> and compile/link with the 64-bit GCC (whatever that may be named), and
> run your C program.  If this fails, which I suspect it will, you will
> know why Mono can't find your library. :-)
Actually I have written a bunch of C programs which compile, link and run a=
gainst=20
that library just fine so unfortunately that doesn't help us much.

> Then, you can tell us what it takes to find the library, I can update my
> guide, and everyone can be happy. :-)
I wish I could. Actually as an example the little program (one of the examp=
les from
Mono - A developers Notebook ) I have attached runs fine in my 32 bit
chroot but not under 64 bit. Both installations are using Mono 1.1.4=20
built from the daily release a couple of days ago. On my 32 bit chroot
libncurses.so lives in /lib. In my 64 bit install it lives in /lib64
(which has a /lib symlink).

Cheers,
James
--=20
It's 5.50 a.m.... Do you know where your stack pointer is ?

--=-OpE61l0MD/YJ2hJPrXrv
Content-Disposition: attachment; filename=Curses.cs
Content-Transfer-Encoding: base64
Content-Type: text/x-csharp; name=Curses.cs; charset=ANSI_X3.4-1968

Ly8gMDItY3NoYXJwLzA3LXBpbnZva2UNCnVzaW5nIFN5c3RlbTsNCnVzaW5nIFN5c3RlbS5SdW50
aW1lLkludGVyb3BTZXJ2aWNlczsNCg0KcHVibGljIGNsYXNzIEN1cnNlcyB7DQoJY29uc3Qgc3Ry
aW5nIExpYnJhcnkgPSAibmN1cnNlcyI7DQoJDQoJW0RsbEltcG9ydChMaWJyYXJ5KV0NCglwcml2
YXRlIGV4dGVybiBzdGF0aWMgSW50UHRyIGluaXRzY3IoKTsNCgkNCglbRGxsSW1wb3J0KExpYnJh
cnkpXQ0KCXByaXZhdGUgZXh0ZXJuIHN0YXRpYyBpbnQgZW5kd2luKCk7DQoNCglbRGxsSW1wb3J0
KExpYnJhcnkpXQ0KCXByaXZhdGUgZXh0ZXJuIHN0YXRpYyBpbnQgbXZ3cHJpbnR3KEludFB0ciB3
aW5kb3csIA0KCQlpbnQgeSwgaW50IHgsIHN0cmluZyBtZXNzYWdlKTsNCg0KCVtEbGxJbXBvcnQo
TGlicmFyeSldDQoJcHJpdmF0ZSBleHRlcm4gc3RhdGljIGludCByZWZyZXNoKEludFB0ciB3aW5k
b3cpOw0KDQoJW0RsbEltcG9ydChMaWJyYXJ5KV0NCglwcml2YXRlIGV4dGVybiBzdGF0aWMgaW50
IHdnZXRjaChJbnRQdHIgd2luZG93KTsNCg0KCXByaXZhdGUgSW50UHRyIHdpbmRvdzsNCgkNCglw
dWJsaWMgQ3Vyc2VzKCkgew0KCQl3aW5kb3cgPSBpbml0c2NyKCk7DQoJfQ0KCQ0KCX5DdXJzZXMo
KSB7DQoJCWludCByZXN1bHQgPSBlbmR3aW4oKTsNCgl9DQoNCglwdWJsaWMgaW50IFByaW50KGlu
dCB4LCBpbnQgeSwgc3RyaW5nIG1lc3NhZ2UpIHsNCgkJcmV0dXJuIG12d3ByaW50dyh3aW5kb3cs
IHksIHgsIG1lc3NhZ2UpOw0KCX0NCgkNCglwdWJsaWMgaW50IFJlZnJlc2goKSB7DQoJCXJldHVy
biByZWZyZXNoKHdpbmRvdyk7DQoJfQ0KCQ0KCXB1YmxpYyBjaGFyIEdldENoYXIoKSB7DQoJCXJl
dHVybiAoY2hhcil3Z2V0Y2god2luZG93KTsNCgl9DQp9DQoNCnB1YmxpYyBjbGFzcyBIZWxsb0N1
cnNlcyB7DQoJcHVibGljIHN0YXRpYyB2b2lkIE1haW4oc3RyaW5nIFtdIGFyZ3MpIHsNCgkJQ3Vy
c2VzIEN1cnNlcyA9IG5ldyBDdXJzZXMoKTsNCgkJQ3Vyc2VzLlByaW50KDEwLCAxMCwgIkhlbGxv
LCBjdXJzZXMhIik7DQoJCUN1cnNlcy5SZWZyZXNoKCk7DQoJCWNoYXIgYyA9IEN1cnNlcy5HZXRD
aGFyKCk7DQoJCUN1cnNlcyA9IG51bGw7DQoJfQ0KfQ0K

--=-OpE61l0MD/YJ2hJPrXrv--

--=-9uFeqiIVMdg8Va705SGW
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQBCDn2Gtf4qL6AoafMRAn22AKDhi/ZPOLCvQAWFRPHlnSdEESM9jwCeMAQk
Uoj8eDJTPsxfns66ohhO3/4=
=sVEf
-----END PGP SIGNATURE-----

--=-9uFeqiIVMdg8Va705SGW--