Link to home
Start Free TrialLog in
Avatar of inteq
inteq

asked on

Questions for win32 dll and data type conversion?????

Dear Expert,
I would like to create one DLL which will accept two variables "key" and "random"..
I am using string variable type as shown in below.

__declspec(dllexport) string __cdecl A3A8(string ki, string random)
{
.....
}

Is it correct for accepting two stings in Win32 DLL?

If it is correct, I also want to change my string into char array.
My currrent codes are:
__declspec(dllexport) string __cdecl A3A8(string ki, string random)
{
           string myreturn;
           char s2[32];
           strcpy(s2,(LPCTSTR)ki);
           int i;
         for (i=0; i<16; i++)
        {
            key[i] = (hextoint(s2[2*i])<<4)| hextoint(s2[2*i+1]);
        }
          return myreturn;

}

I ve got the errors:
C:\Program Files\Microsoft Visual Studio\MyProjects\09_01_09\09_01_09.cpp(47) : error C2440: 'type cast' : cannot convert from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Please help me to change the string into char array..
Thank you in advance . Regards!

ASKER CERTIFIED SOLUTION
Avatar of Gurudenis
Gurudenis
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial