[Mono-dev] Load Librery ....

Robert Jordan robertj at gmx.net
Sat Nov 18 08:25:21 EST 2006


Kimerop Kimeropweb.com wrote:
> Greetings to all…. As a bookstore can be loaded, elaborated in another 
> language for example DLL or a bookstore of linux, and to implement its 
> functions…. In tactical mission the bookstore of linux (sys/io.h) ioperm and 
> outb Some example, Gracias….

outb is an inline function in Linux, so you'll have to create
a shared library wrapper to be able to p/invoke it from the managed
world, something like that (untested):

/* outb.c */

#include <sys/io.h>

void my_outb (unsigned char value, unsigned short int port)
{
	outb (value, port);
}


gcc -O2 -o liboutb.so -shared -fPIC outb.c



/* test.cs */
using System;
using System.Runtime.InteropServices;

class T
{
         [DllImport("liboutb")]
         public static extern void
         my_outb(byte value, ushort port);

         [DllImport("libc")]
         public static extern int
         ioperm(uint from, uint num, int turn_on);
}


Robert




More information about the Mono-devel-list mailing list