[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [DotGNU]InternalCall or: how to call system libs
From: |
Rhys Weatherley |
Subject: |
Re: [DotGNU]InternalCall or: how to call system libs |
Date: |
Fri, 29 Mar 2002 09:19:34 +1000 |
Timo --Blazko-- Boewing wrote:
> i have read several documentations from the DotGNU project, but so far i
> have no idea of how to call system libraries.
> Supposed a library is equally available on all platforms (e.g. some GNU
> tools/ports) supported by DotGNU (so, a ".dll" on Win32/64 and a ".so"
> on UN*X :-)), can i do these native system calls directly from a C# lib
> e.g. from System.x.y?
What you are looking for is the PInvoke mechanism,
not InternalCall. Have a look at the "pnetcurses"
program, distributed on my Web site:
http://www.southern-storm.com.au/portable_net.html
The "src/Native.cs" file provides examples of how to
interface to external .dll/.so files, and how to handle the
icky issue of the .dll/.so files being called different
things on different platforms.
Note: pnet's C# compiler doesn't support all of the
necessary attributes just yet, so it is necessary to
build such programs with Microsoft's compiler, until
such time as I can get attributes working (soon).
Once compiled with Microsoft's compiler, it will run
on pnet's engine just fine.
Cheers,
Rhys.