Click here to Skip to main content
15,912,897 members
Home / Discussions / C#
   

C#

 
GeneralRe: Adapting form size to content size Pin
sinosoidal28-Mar-07 23:25
sinosoidal28-Mar-07 23:25 
QuestionMaximized child MDI form Pin
sinosoidal28-Mar-07 5:39
sinosoidal28-Mar-07 5:39 
Questiondisplaying images from a xml file Pin
diducmy28-Mar-07 5:35
diducmy28-Mar-07 5:35 
AnswerRe: displaying images from a xml file Pin
Martin#28-Mar-07 5:56
Martin#28-Mar-07 5:56 
QuestionXmlSerializer and CDATA Pin
theJazzyBrain28-Mar-07 5:15
theJazzyBrain28-Mar-07 5:15 
QuestionConverting a string to currency format Pin
lee.hallows28-Mar-07 5:09
lee.hallows28-Mar-07 5:09 
AnswerRe: Converting a string to currency format Pin
joon vh.28-Mar-07 5:17
joon vh.28-Mar-07 5:17 
QuestionUsing reference parameters when calling an exposed function from a DLL Pin
Dewald28-Mar-07 5:09
Dewald28-Mar-07 5:09 
Hi all, I'm hoping someone ca help me out here as I've been stuck on this one for a while now.

I have a DLL (written in C++) that exposes the following function:
int sendAPDU (byte* TxAPDU, int TxLen, byte* RxAPDU, int* RxLen)

Essentially, this function takes an array of bytes (TxAPDU) with TxLen elements and returns an array of byte (RxAPDU) with RxLen elements. The key issue here which is throwing me is the fact that the last two parameters are reference parameters (or strictly speaking output parameters).

My problem is that, in C#, I can't seem to figure out how to import that function from the DLL and call it. I thought it would be something like:
[DllImport("MyLibrary.dll", EntryPoint = "sendAPDU")]<br />
public static extern int sendAPDU(Byte[] TxAPDU, int TxLen, ref Byte[] RxAPDU, ref int RxLen);


And then when calling the function it'd be something like:
Byte [] TxArray = new Byte[26];<br />
Byte [] RxArray = new Byte[MAX_APDU_LEN];<br />
int RxLength;<br />
// Do something to populate TxArray<br />
<br />
int retval = sendAPDU (TxArray, 26, ref RxArray, ref RxLen);


So what is it that I'm doing wrong? Forgive me if this is a straight forward issue but I'm ew to C#.
AnswerRe: Using reference parameters when calling an exposed function from a DLL Pin
m@u28-Mar-07 5:29
m@u28-Mar-07 5:29 
GeneralRe: Using reference parameters when calling an exposed function from a DLL Pin
Dewald28-Mar-07 23:39
Dewald28-Mar-07 23:39 
QuestionGuidance Automation Toolkit or CodeSmith? Pin
wojti28-Mar-07 5:03
wojti28-Mar-07 5:03 
Questioncalling function in parent form from child form Pin
Lordveralix28-Mar-07 4:13
Lordveralix28-Mar-07 4:13 
AnswerRe: calling function in parent form from child form Pin
Pete O'Hanlon28-Mar-07 4:22
mvePete O'Hanlon28-Mar-07 4:22 
GeneralRe: calling function in parent form from child form Pin
Lordveralix28-Mar-07 4:51
Lordveralix28-Mar-07 4:51 
GeneralRe: calling function in parent form from child form Pin
Pete O'Hanlon28-Mar-07 4:54
mvePete O'Hanlon28-Mar-07 4:54 
GeneralRe: calling function in parent form from child form Pin
Lordveralix28-Mar-07 5:13
Lordveralix28-Mar-07 5:13 
GeneralRe: calling function in parent form from child form Pin
Lordveralix28-Mar-07 7:11
Lordveralix28-Mar-07 7:11 
Question[Message Deleted] Pin
pashitech28-Mar-07 3:56
pashitech28-Mar-07 3:56 
AnswerRe: how to find help tools Pin
Judah Gabriel Himango28-Mar-07 4:06
sponsorJudah Gabriel Himango28-Mar-07 4:06 
AnswerRe: how to find help tools Pin
Judah Gabriel Himango28-Mar-07 4:55
sponsorJudah Gabriel Himango28-Mar-07 4:55 
GeneralRe: how to find help tools Pin
pashitech28-Mar-07 5:36
pashitech28-Mar-07 5:36 
QuestionREMOTE INSTALL Pin
waddah_com28-Mar-07 3:55
waddah_com28-Mar-07 3:55 
AnswerRe: REMOTE INSTALL Pin
Judah Gabriel Himango28-Mar-07 4:05
sponsorJudah Gabriel Himango28-Mar-07 4:05 
AnswerRe: REMOTE INSTALL Pin
Judah Gabriel Himango28-Mar-07 4:57
sponsorJudah Gabriel Himango28-Mar-07 4:57 
AnswerRe: REMOTE INSTALL Pin
Vasudevan Deepak Kumar28-Mar-07 7:52
Vasudevan Deepak Kumar28-Mar-07 7:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.