-
DLL trouble
Hi, I am using Dev-C++ and I made my first DLL. The DLL added two numbers together and returned the sum. I tried to send a string and have it send it back but for some reason it just sends back nothing. Here's my code...
dll.cpp
Code:
char* DllClass::String(char* string)
{string = "Hello World";
return string;}
dllclient.cpp
Code:
int main()
{
char* iValue;
char* vReturn;
DllClass Value;
cin >> iValue;
vReturn = Value.Encrypt(iValue);
cout << vReturn;
system("PAUSE");
}
Keep in mind the DLL works when dealing with numbers, so I'm not sure what the problem here is... Thanks anyways.
-
You can't just assign a string like that. You would need to use strcpy.
-
cin >> iValue;
iValue is not initialized pointer... You just asking from the cin to write the input data on some random address...
-
Hmm I'm sorry I don't think I understand. :( If you could by any chance show me the code you think I should use to get the Dll code to return the string to the exe. Thanks again :\
-
dll.cpp
Code:
std::string DllClass::String(std::string string)
{string = "Hello World";
return string;}
dllclient.cpp
Code:
int main()
{
std::string iValue;
std::string vReturn;
DllClass Value;
cin >> iValue;
vReturn = Value.String(iValue);
cout << vReturn;
system("PAUSE");
}