is it possible to send an char array to a DLL library?

Posted By: pjotr987

is it possible to send an char array to a DLL library? - 12/15/12 12:24

hi guys,
i have the following question. i want to send files over network, therefore i have a program that works fine as C++ console program. i provide the ip and the path of the file as parameters. now i wanted to make a function for 3DGS. here is the code for the socket initiation:

DLLFUNC void* start_network(int stat, char* ziel[])
{

if(stat==1)
{
runserver();
}
if(stat==2)
{
runclient(ziel[1],ziel[2]);
}
return 0;
}


first problem:
how to pass a char array to the start_network function. so that i can set the ip and path in 3dgs.
second question:
if it is possible how to initialize and call the start_network function in LiteC.
by the way the server part is working properly, the problem seems to be around char* ziel[] array data exchange.

thanks in advance for any sugestions
Posted By: Error014

Re: is it possible to send an char array to a DLL library? - 12/16/12 12:37

So, here's your disclaimer: I'm an idiot, have absolutely no programming experience with DLLs, consider them black vodoo magic vastly beyond my abilities, and should probably not answer.


But did you know about _chr?

Quote:

_chr(STRING* string);

Converts a STRING to a null-terminated character array; sometimes useful for functions called from external languages.

Parameters:
string - STRING* or char* pointer to be converted.

Returns:
char* - pointer to the char array contained in the STRING*.

Speed:
Fast

Remarks:
This function automatically detects whether its argument is a STRING* or a char*; the char* string must be null-terminated and contain at least 3 characters.

Example:
my_dll_function(_chr(pMyString));


(for completeness' sake, there's also _str, which turns a char*-string to a STRING*-string)


Again, I'm not building on any kind of experience here, so apologies if this doesn't help at all. It did kinda fit the question, though laugh
© 2024 lite-C Forums