473,385 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help converting C struct w/function pointers

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
1 1449
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thomas Connolly | last post by:
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...
2
by: Thomas Connolly | last post by:
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...
2
by: leo2100 | last post by:
Hi, I need help with this program. The program is supposed to take a text file and identify the words in it, then it should print them and count how many times a word is repeated. At first main...
7
by: ghulands | last post by:
I am having trouble implementing some function pointer stuff in c++ An object can register itself for many events void addEventListener(CFObject *target, CFEventHandler callback, uint8_t...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.