02-18-2009 10:00 AM
I have a function in my C++ DLL.
static BOOL InitializeConnection(unsigned char* receivedData, unsigned int* receivedDataLength,
unsigned int* errorCode, unsigned char errorMessage[512]);
I would like to use a string for the last parameter. When it loads the prototype of function, the type is unsigned char [].
When I enter my Locals.str, it give me the error "Expecting nothing, array of number or array of booleans. Found string"
If I change in the right panel the Category to String and select the Type "C String Buffer", the error goes away and I receive the string value correctly from my dll.
However, I have the red '!" icon flashing next to my function name that says I need to reload the function. Is there a way to get rid of it? I don't want other programmers on my project to hit it and lose all the configuration.
Also, do I need to do something special so when it loads the function, I dont get "arg1, arg2, arg3" as parameter name but the one from my dll?
I usually program in C# and it loads correctly the right parameters name.
Thank you.
-Mat, CTD
02-19-2009 02:35 PM
02-19-2009 04:16 PM
Thanks for the answer Adri.
I got rid of the red ! by switching to char instead of unsigned char.
For the second part, not being able to see the parameter names, I do use the __declspec(dllexport) at the class level. I switched to the way explained in the tutorial without any difference.
class DisplaySeriesComm : public CWinApp
{
public:
DisplaySeriesComm();
~DisplaySeriesComm();
static BOOL OpenInterface(CCommunication* ptrCom, signed int* errorCode, char errorMessage[512]);
static BOOL CloseInterface(CCommunication* ptrCom);
static __declspec(dllexport) BOOL InitializeConnection(unsigned char* receivedData, unsigned int* receivedDataLength, signed int* errorCode, char errorMessage[512]);
...
}
I have access to the function in TestStand, the parameters load with the correct types (the column: Description). It's only the names which are set by default to arg1, arg2, ...
By comparing to the tutorial, the dll I used is an MFC dll and it also uses a .def file. Not sure if it could be related to that.
Thanks.
02-20-2009 09:58 AM
The names of the function parameters are not stored in the DLL created by Visual Studio, so TestStand just sets them to arg1, arg2, etc. The names are cosmetic only and do not affect the way the function is called.
If you really want to have the parameter names appear in TestStand, you can use a type library to describe the function prototype. TestStand will use the type library if it is embedded within the DLL or if it has the same name as the DLL and resides in the same directory as the DLL.