[Mono-list] P/Invoke problem

Louis R. Marascio marascio@metreos.com
Mon, 2 Feb 2004 14:35:45 -0600

I'm trying to build a managed wrapper on top of POSIX message queues.  For
development, I'm working on WinXp using pthreads-win32 + mqueues (as
contributed by a third party to the pthreads-win32 project).

I've build my wrapper and it executes fine using the MS .NET runtime.
However, under Mono, I get a System.EntryPointNotFoundException each time I
try to use a P/Invoke. I've been banging my head against this for a while
now, and really am not sure what else to try. 

I have a PthreadsVc.dll, on which 'dumpbin /exports' gives:

(... Bunch of stuff removed ...)

    ordinal hint RVA      name

          1    0 00001890 mq_close
          2    1 00001000 mq_getattr
          3    2 00001080 mq_notify
          4    3 000010A0 mq_open
          5    4 000014E0 mq_receive
          6    5 00001630 mq_send
          7    6 000017C0 mq_setattr
          8    7 00001870 mq_unlink

(... Bunch of stuff removed ...)

My DllImport for mq_close looks like:

    // int mq_close(mqd_t);
    public static extern int mq_close(IntPtr queueHandle);

I've tried various parameters on the DllImport such as CallingConvention,
CharSet, etc etc. Nothing seems to work.  From what I can tell I'm doing
exactly what the SqliteDataProvider does with SQLite.  I'm sure I'm
overlooking something important here...

I've tried building PthreadVc.dll with both VS.NET 7.1 and VS 6.0 without
any effect on the outcome. Also, the DLL is always built in release mode.

Any help would be greatly appreciated. Thanks,


Louis R. Marascio
Metreos Corporation
o: +1 (512) 437 7903
m: +1 (832) 768 4609
e: marascio@metreos.com