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.
> 
> I know what it says; I wrote it.  
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 noticed 
much 
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 
/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 
against 
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 examples 
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 
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
-- 
It's 5.50 a.m.... Do you know where your stack pointer is ?
// 02-csharp/07-pinvoke
using System;
using System.Runtime.InteropServices;

public class Curses {
	const string Library = "ncurses";
	
	[DllImport(Library)]
	private extern static IntPtr initscr();
	
	[DllImport(Library)]
	private extern static int endwin();

	[DllImport(Library)]
	private extern static int mvwprintw(IntPtr window, 
		int y, int x, string message);

	[DllImport(Library)]
	private extern static int refresh(IntPtr window);

	[DllImport(Library)]
	private extern static int wgetch(IntPtr window);

	private IntPtr window;
	
	public Curses() {
		window = initscr();
	}
	
	~Curses() {
		int result = endwin();
	}

	public int Print(int x, int y, string message) {
		return mvwprintw(window, y, x, message);
	}
	
	public int Refresh() {
		return refresh(window);
	}
	
	public char GetChar() {
		return (char)wgetch(window);
	}
}

public class HelloCurses {
	public static void Main(string [] args) {
		Curses Curses = new Curses();
		Curses.Print(10, 10, "Hello, curses!");
		Curses.Refresh();
		char c = Curses.GetChar();
		Curses = null;
	}
}

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to