By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,681 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,681 IT Pros & Developers. It's quick & easy.

Help converting C struct w/function pointers

P: n/a
Hello list,
No one seems to be replying to my request on the interop group so I thought I would try here.
Can someone please help me with this? I have a C struct containing function pointers like so:

typedef struct _tagLiffeResponseHandlerList
{

void (*OnAccessTransfer) (LiffeStatus eStatus, const char* pszTrader, LiffeBoolean bContinuationFlag,
int nNumOrders, const LiffeOrderEntryList* pcLiffeOrderEntryList, time_t nTimeStamp);

****** other function pointers omitted for brevity *******

} LiffeResponseHandlerList;

Would the following be correct?

public delegate void OnAccessTransfer(LiffeStatus eStatus, [MarshalAs(UnmanagedType.LPStr)] string pszTrader, LiffeBoolean bContinuationFlag, int nNumOrders, ref LiffeOrderEntryList pcLiffeOrderEntryList, uint nTimeStamp);

[StructLayout(LayoutKind.Sequential)]
public class LiffeResponseHandlerList
{
public OnAccessTransfer OnAccessTransfer;
}

Thanks for the help
Jul 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
it looks right, you have to try it.

you don't describe the definitions for
LiffeStatus, LiffeBoolean or LiffeOrderEntryList,
so I will assume you have those right.

see also
http://msdn.microsoft.com/library/en...rp09192002.asp
"Thomas Connolly" <to**@cqg.com> wrote in message
news:uO**************@tk2msftngp13.phx.gbl...
Hello list,
No one seems to be replying to my request on the interop group so I
thought I would try here.
Can someone please help me with this? I have a C struct containing
function pointers like so:

typedef struct _tagLiffeResponseHandlerList
{

void (*OnAccessTransfer) (LiffeStatus eStatus, const char* pszTrader,
LiffeBoolean bContinuationFlag,
int nNumOrders, const LiffeOrderEntryList* pcLiffeOrderEntryList, time_t
nTimeStamp);

****** other function pointers omitted for brevity *******

} LiffeResponseHandlerList;

Would the following be correct?

public delegate void OnAccessTransfer(LiffeStatus eStatus,
[MarshalAs(UnmanagedType.LPStr)] string pszTrader, LiffeBoolean
bContinuationFlag, int nNumOrders, ref LiffeOrderEntryList
pcLiffeOrderEntryList, uint nTimeStamp);

[StructLayout(LayoutKind.Sequential)]
public class LiffeResponseHandlerList
{
public OnAccessTransfer OnAccessTransfer;
}

Thanks for the help

Jul 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.