re:PInvoke. Passing void* instance.

From: promko (panas_at_eleks-dot-com.no-spam.invalid)
Date: 10/25/04


Date: 25 Oct 2004 01:55:14 -0500

ok. maybe I was dismissed that the problem is in the last parameter.
The whole code I try:

[ DllImport( "cabinet.dll", CallingConvention =
CallingConvention.Cdecl ) ]
public static extern IntPtr FCICreate(
[ In, Out, MarshalAs( UnmanagedType.LPStruct ) ]
ERF perf,
PFNFCIFILEPLACED pfnfcifp,
PFNFCIALLOC pfna,
PFNFCIFREE pfnf,
PFNFCIOPEN pfnopen,
PFNFCIREAD pfnread,
PFNFCIWRITE pfnwrite,
PFNFCICLOSE pfnclose,
PFNFCISEEK pfnseek,
PFNFCIDELETE pfndelete,
PFNFCIGETTEMPFILE pfnfcigtf,
[ In, Out, MarshalAs( UnmanagedType.LPStruct ) ]
CCAB pccab,
IntPtr pv );

, where PFNF*** - delegates are.

FciAPI.FCICreate(
          erf,
          new PFNFCIFILEPLACED( file_placed ),
          new PFNFCIALLOC( mem_alloc ),
          new PFNFCIFREE( mem_free ),
          new PFNFCIOPEN( fci_open ),
          new PFNFCIREAD( fci_read ),
          new PFNFCIWRITE( fci_write ),
          new PFNFCICLOSE( fci_close ),
          new PFNFCISEEK( fci_seek ),
          new PFNFCIDELETE( fci_delete ),
          new PFNFCIGETTEMPFILE( get_temp_file ),
          cab_parameters,
          (IntPtr)gch
);

HFCI __cdecl FCICreate( PERF perf,
                          PFNFCIFILEPLACED pfnfcifp,
                          PFNFCIALLOC pfna,
                          PFNFCIFREE pfnf,
                          PFNFCIOPEN pfnopen,
                          PFNFCIREAD pfnread,
                          PFNFCIWRITE pfnwrite,
                          PFNFCICLOSE pfnclose,
                          PFNFCISEEK pfnseek,
                          PFNFCIDELETE pfndelete,
                          PFNFCIGETTEMPFILE pfnfcigtf,
                          PCCAB pccab,
                          void FAR * pv
);

*-----------------------*
        Posted at:
  www.GroupSrv.com
*-----------------------*