[Mono-list] managed code thunks for unmanaged functions?

Michael Poole poole@troilus.org
18 Oct 2002 00:56:21 -0400


I would like to write a C# PInvoke binding for the Sleepycat Berkeley
Database library.  Part of the API is a structure similar to this:

  typedef struct __db DB;
  struct __db {
    int (*func)(DB *db, int arg);
  };
  int DB_create(DB **dbp);

DB_create() allocates and initializes the structure, writes it into
*dbp, and sets several function pointers inside the structure.  The
preferred way to perform operations on the database is to make calls
using the function pointers kept in the DB struct.

However, Mono does not seem to create wrappers for those function
pointers.  Has anyone started on this?  Would it just reuse
mono_create_trampoline() in some reasonably straightforward way?

-- Michael