Re: Calling DLL function from C# and char** parameter type



Yes, argc is a count and it doesn't matter if I specify 2 or 0 or any other
number. It's the same in all cases.


regards
Tomaz


"Rudy Velthuis" <newsgroups@xxxxxxxxxxxx> wrote in message
news:xn0fl6q8t8425pr00o@xxxxxxxxxxxxxxxxxxxxx
TomazK wrote:

[DllImport("libmysqld.dll")]
private static extern int mysql_server_init(int argc, string[] argv,
string[] groups);


{
string[] argv = new string[1];
argv[0] = "mysql_test";


string[] groups = new string[2];
groups[0] = "libmysqd_server";
groups[1] = "libmysqd_client";


mysql_server_init(0, argv, groups);
}

Assuming that argc is an argument count, it should probably not be 0,
and assuming that to each arg there is a group, you should probably
have argc=2, and also have two (2)strings in each array:

{
string[] argv = new string[2];
argv[0] = "mysql_test";
argv[1] = argv[0];

string[] groups = new string[2];
groups[0] = "libmysqd_server";
groups[1] = "libmysqd_client";

mysql_server_init(2, argv, groups);
}

Of course, I have no idea which strings are valid. Try to convert a C
or C++ example, if you have one, to C#.

--
Rudy Velthuis http://rvelthuis.de

"The object of war is not to die for your country but to make
the other *** die for his."
-- General George Patton (1885-1945)


.


Loading