Click here to Skip to main content
15,893,161 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to pass null to a ref bool or out bool parameter? Pin
Charlie Williams26-Mar-04 6:41
Charlie Williams26-Mar-04 6:41 
GeneralRe: How to pass null to a ref bool or out bool parameter? Pin
partyganger26-Mar-04 9:41
partyganger26-Mar-04 9:41 
AnswerRe: How to pass null to a ref bool or out bool parameter? Pin
Judah Gabriel Himango26-Mar-04 6:45
sponsorJudah Gabriel Himango26-Mar-04 6:45 
GeneralRe: How to pass null to a ref bool or out bool parameter? Pin
Heath Stewart26-Mar-04 7:54
protectorHeath Stewart26-Mar-04 7:54 
GeneralRe: How to pass null to a ref bool or out bool parameter? Pin
Judah Gabriel Himango26-Mar-04 7:59
sponsorJudah Gabriel Himango26-Mar-04 7:59 
GeneralRe: How to pass null to a ref bool or out bool parameter? Pin
Heath Stewart26-Mar-04 8:09
protectorHeath Stewart26-Mar-04 8:09 
AnswerRe: How to pass null to a ref bool or out bool parameter? Pin
leppie28-Mar-04 7:32
leppie28-Mar-04 7:32 
GeneralAnother Interop Question.... Pin
schnee2k326-Mar-04 5:23
schnee2k326-Mar-04 5:23 
Hey all...ok, let me set things up...here is the prototype of the function i'm trying to use in an unmanaged dll within C#:

void myfunc(int a, int b, pvoid* output);

Ok, so the return here (output) will be a pointer to an array of pointers....within that array, each pointer is to point at the following structure:

struct MYSTRUCT{<br />
DWORD size,<br />
PWSTR aString,<br />
PWSTR anotherString<br />
} MYSTRUCT, *PMYSTRUCT;


I read on ms site that in order to handle the strings in the array, I need to define it as such:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]<br />
public struct MYSTRUCT<br />
{<br />
	public uint size;<br />
	public String aString;<br />
	public String anotherString;<br />
	public MYSTRUCT(uint size, String aString, String anotherString)<br />
	{<br />
		this.aString= aString;<br />
		this.anotherString= anotherString;<br />
		this.size= size;<br />
	}<br />
}


Here is my imported function:

[DllImport("mydll.dll")]<br />
public static extern void myfunc(int a, int b, out MYSTRUCT[] output);


Now...this doesn't work, I don't even get returned the correct size of MYSTRUCT[]. I've tried quite a number of different variations as well. I've tried passing an array of IntPtr too, all to no avail. How does one deal with this? Do I need to get back the array of pointers and actually deal with the pointers themselves?

Jason
GeneralRe: Another Interop Question.... Pin
John Fisher26-Mar-04 7:13
John Fisher26-Mar-04 7:13 
GeneralRe: Another Interop Question.... Pin
schnee2k326-Mar-04 7:28
schnee2k326-Mar-04 7:28 
GeneralRe: Another Interop Question.... Pin
Heath Stewart26-Mar-04 7:51
protectorHeath Stewart26-Mar-04 7:51 
GeneralRe: Another Interop Question.... Pin
schnee2k326-Mar-04 8:29
schnee2k326-Mar-04 8:29 
GeneralDataGrid, 2 (easy) Questions Pin
DougW4826-Mar-04 4:59
DougW4826-Mar-04 4:59 
GeneralRe: DataGrid, 2 (easy) Questions Pin
SapiensBwG26-Mar-04 6:20
SapiensBwG26-Mar-04 6:20 
GeneralRe: DataGrid, 2 (easy) Questions Pin
DougW4826-Mar-04 6:55
DougW4826-Mar-04 6:55 
GeneralRe: DataGrid, 2 (easy) Questions Pin
Charlie Williams26-Mar-04 7:16
Charlie Williams26-Mar-04 7:16 
GeneralRe: DataGrid, 2 (easy) Questions Pin
partyganger26-Mar-04 9:54
partyganger26-Mar-04 9:54 
GeneralCommunicating with a Thread Pin
Demian Panello26-Mar-04 4:24
Demian Panello26-Mar-04 4:24 
GeneralRe: Communicating with a Thread Pin
Judah Gabriel Himango26-Mar-04 4:51
sponsorJudah Gabriel Himango26-Mar-04 4:51 
GeneralRe: Communicating with a Thread Pin
SapiensBwG26-Mar-04 5:00
SapiensBwG26-Mar-04 5:00 
GeneralRe: Communicating with a Thread Pin
Judah Gabriel Himango26-Mar-04 5:05
sponsorJudah Gabriel Himango26-Mar-04 5:05 
GeneralRe: Communicating with a Thread Pin
Heath Stewart26-Mar-04 4:58
protectorHeath Stewart26-Mar-04 4:58 
GeneralRe: Communicating with a Thread Pin
Judah Gabriel Himango26-Mar-04 5:24
sponsorJudah Gabriel Himango26-Mar-04 5:24 
GeneralRe: Communicating with a Thread Pin
SapiensBwG26-Mar-04 5:44
SapiensBwG26-Mar-04 5:44 
GeneralRe: Communicating with a Thread Pin
Demian Panello26-Mar-04 6:45
Demian Panello26-Mar-04 6:45 

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.