PDA

View Full Version : DLL call with multiple string parameters



supertodd85
12-11-2007, 10:06 AM
I'm having a lot of trouble with DLL.CallFunction when I pass multiply strings to the DLL. It seems that only the first one is actually passed.

SF 7.0.6.1 code:

nReturn = DLL.CallFunction("C:\\EngDlx\\InstallDll_Dlx.dll", "InstallMonitor", "\"First String\", \"Second String\"", DLL_RETURN_TYPE_INTEGER, DLL_CALL_CDECL);

The dll looks like:

extern "C" __declspec(dllexport) int InstallMonitor(LPTSTR pName, LPTSTR pFileName)
{ ...
AfxMessageBox(pName);
AfxMessageBox(pFileName);
...

This first message box pops up with "First String" in it, the second message box pops up blank.

I've also tested this with a dll function with 8 string parameters followed by one int parameter. The int parameter is passed with no problems, but only the first string parameter on the list of string parameters is passed.

Is this a bug with DLL.CallFunction or am I missing something? I could always combine all the string parameters into one string parameter and then split it up in the DLL call, but this seems unnecessarily circuitous.

supertodd85
12-14-2007, 04:09 PM
I ended up combining all string parameters into one string separated by newline characters, then the DLL tokenizes the single string parameter.

However, has anyone else run into this problem?