Click here to Skip to main content
15,887,453 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to customize the Form class? PinPopular
Pete O'Hanlon27-Jan-11 22:21
mvePete O'Hanlon27-Jan-11 22:21 
AnswerRe: how to customize the Form class? Pin
nlarson1128-Jan-11 8:36
nlarson1128-Jan-11 8:36 
QuestionFree SMS API Pin
Anil Kumar.Arvapalli27-Jan-11 20:27
Anil Kumar.Arvapalli27-Jan-11 20:27 
AnswerRe: Free SMS API Pin
Richard MacCutchan28-Jan-11 1:36
mveRichard MacCutchan28-Jan-11 1:36 
QuestionClearing IE browsing history Pin
rakeshs31227-Jan-11 20:04
rakeshs31227-Jan-11 20:04 
AnswerRe: Clearing IE browsing history Pin
Not Active27-Jan-11 20:17
mentorNot Active27-Jan-11 20:17 
AnswerReason for my vote of one: Pin
OriginalGriff27-Jan-11 20:24
mveOriginalGriff27-Jan-11 20:24 
QuestionWorking with native dll (dynamic string array and double indirection) Pin
csrss27-Jan-11 13:15
csrss27-Jan-11 13:15 
Ok, so here is the problem. I got native dll which contains and utilizes my own class for building dynamic string arrays. Here is a simple example how it works in C(++):

wchar_t **GetArray()
{
	ArrayBuilder *arrb = new ArrayBuilder();
	arrb->Append(L"test1");
	arrb->Append(L"test2");
	arrb->Append(L"test3");
	return arrb->GetArray();
}

wchar_t **myarray = GetArray();
wprintf(L"Element1: %s, element2: %s and element3: %s\r\n", myarray[0], myarray[1], myarray[2]);


Assuming that i am exporting this small test function "GetArray" from dll:

extern "C" { __declspec(dllexport)wchar_t **GetArray() }


How can i get this string array in my C# app? I have tried something like:

[DllImport("db.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern List<String> GetArray();


or

public static extern String[] GetArray();

or

public static extern Array GetArray();


Nothing works. It throws that it "cannot marshal return value: Generic types cannot be marshaled", or, in case of last approach, some HRESULT error. So in fact i have missed something, but what? What is the right way to call this function in C# app?
Thanks
011011010110000101100011011010000110100101101110
0110010101110011

AnswerRe: Working with native dll (dynamic string array and double indirection) Pin
csrss27-Jan-11 14:39
csrss27-Jan-11 14:39 
QuestionBreaking Up Classes Pin
Richard Andrew x6427-Jan-11 11:40
professionalRichard Andrew x6427-Jan-11 11:40 
AnswerRe: Breaking Up Classes Pin
TheGreatAndPowerfulOz27-Jan-11 11:49
TheGreatAndPowerfulOz27-Jan-11 11:49 
GeneralRe: Breaking Up Classes Pin
Richard Andrew x6427-Jan-11 11:53
professionalRichard Andrew x6427-Jan-11 11:53 
GeneralRe: Breaking Up Classes Pin
TheGreatAndPowerfulOz27-Jan-11 12:36
TheGreatAndPowerfulOz27-Jan-11 12:36 
AnswerRe: Breaking Up Classes Pin
RobCroll27-Jan-11 11:55
RobCroll27-Jan-11 11:55 
AnswerRe: Breaking Up Classes Pin
dan!sh 27-Jan-11 12:03
professional dan!sh 27-Jan-11 12:03 
GeneralRe: Breaking Up Classes Pin
TheGreatAndPowerfulOz27-Jan-11 12:37
TheGreatAndPowerfulOz27-Jan-11 12:37 
AnswerRe: Breaking Up Classes Pin
GlobX27-Jan-11 12:10
GlobX27-Jan-11 12:10 
GeneralRe: Breaking Up Classes Pin
TheGreatAndPowerfulOz27-Jan-11 12:39
TheGreatAndPowerfulOz27-Jan-11 12:39 
QuestionRe: Breaking Up Classes [modified] Pin
GlobX27-Jan-11 12:46
GlobX27-Jan-11 12:46 
GeneralRe: Breaking Up Classes Pin
Manfred Rudolf Bihy27-Jan-11 12:54
professionalManfred Rudolf Bihy27-Jan-11 12:54 
QuestionRe: Breaking Up Classes Pin
GlobX27-Jan-11 12:58
GlobX27-Jan-11 12:58 
AnswerRe: Breaking Up Classes Pin
Manfred Rudolf Bihy27-Jan-11 13:41
professionalManfred Rudolf Bihy27-Jan-11 13:41 
GeneralRe: Breaking Up Classes Pin
GlobX27-Jan-11 13:50
GlobX27-Jan-11 13:50 
GeneralRe: Breaking Up Classes Pin
Manfred Rudolf Bihy27-Jan-11 13:56
professionalManfred Rudolf Bihy27-Jan-11 13:56 
AnswerRe: Breaking Up Classes Pin
TheGreatAndPowerfulOz27-Jan-11 13:43
TheGreatAndPowerfulOz27-Jan-11 13:43 

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.