471,317 Members | 1,792 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Defining prototypes for C++ dll functions in C#

I have reqirements of defining prototypes for C++ dll function in C# so that
I can use p/invoke method to access the dll's functions.

Can anyone please suggest how to write prototypes in C# for C++ functions
like the ones given below:
1. __declspec(dllexport) char * __stdcall GetString(int maxChars, int
waitTime, int delay = 50);

2. __declspec(dllexport) BOOL __stdcall GetControlData(DWORD commandType,
BYTE* pInBuf, DWORD inSize, BYTE *pOutBuf, DWORD outSize, LPDWORD
bytesReturned, LPOVERLAPPED pOverlapped);

3. __declspec(dllexport) DWORD * __stdcall GetStats(BOOL clear);

4. __declspec(dllexport) UNIT_TYPES* __stdcall GetUnitsInfo(void);
where UNIT_TYPES is a structure:

typedef struct
{
char *name;
int num_units;
int unit_list[10];
}UNIT_TYPES;

5. __declspec(dllexport) int __stdcall HandleCommand(CHANDLE han, int Id,
const BYTE cmd, DWORD const responseType, const int txCount=0, BYTE const *
pTxData=NULL, BYTE *pRxData=NULL, BYTE *pRxCount=NULL, DWORD retries=4, DWORD
wait_ms=0);

6. __declspec(dllexport) void __stdcall HandleGetTimeouts(CHANDLE han, DWORD
*normal, DWORD *download, DWORD *retries);

7. __declspec(dllexport) int __stdcall SendCommand(int Id, const BYTE cmd,
DWORD const responseType, const int txCount=0, BYTE const * pTxData=NULL,
BYTE *pRxData=NULL, BYTE *pRxCount=NULL, DWORD retries=4, DWORD wait_ms=0);
Regards,

Nataraj.

--
Regards,
Nataraj S. Narayana

Senior Engineer - Windows

Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...sharp/200602/1
Feb 20 '06 #1
0 1042

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Michele Simionato | last post: by
14 posts views Thread by fb | last post: by
9 posts views Thread by Grumble | last post: by
13 posts views Thread by DevarajA | last post: by
1 post views Thread by petermichaux | last post: by
26 posts views Thread by Cliff Williams | last post: by
7 posts views Thread by Roman Mashak | last post: by
73 posts views Thread by Steph Barklay | last post: by

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.