473,387 Members | 1,512 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,387 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 1117

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Michele Simionato | last post by:
So far, I have not installed Prothon, nor I have experience with Io, Self or other prototype-based languages. Still, from the discussion on the mailing list, I have got the strong impression that...
14
by: fb | last post by:
Does the C language require you to prototype functions? If it's not required, is it recommended?
9
by: Grumble | last post by:
Hello everyone, I've come across some strange code. Here it is, stripped down: int main(void) { int *foo; int *bar(); foo = bar(0); return 0;
13
by: DevarajA | last post by:
If a function is visible everywhere, even out the file where it is declared and defined, why should i write prototypes? -- Devaraja (Xdevaraja87^gmail^c0mX) Linux Registerd User #338167...
1
by: petermichaux | last post by:
Hi, I have searched the archives but didn't find the questions and answers I am looking for. I have been looking at Prototype.js quite a bit lately as I need to create a very small library of...
26
by: Cliff Williams | last post by:
Can someone explain the pros/cons of these different ways of creating a class? // 1 function myclass() { this.foo1 = function() {...} } // 2a
7
by: Roman Mashak | last post by:
Hello, I have a small piece of code, compiled by two 'gcc' and 'borland builder compiler'. The latter one produces warnings: Public symbol '_freq' defined in both module...
73
by: Steph Barklay | last post by:
Hi, I'm currently taking a data structures course in C, and my teacher said that function prototypes are not allowed in any of our code. He also said that no professional programmers use function...
0
by: savanior | last post by:
I'm working with some piece of code where I need to do marshalling. But, the problem is that, I want a user of my system to give a path of dll alongwith its name. And my system will load that Dll at...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.