The conversion DLL has to be a native Win32 DLL (no .NET assembly). To create it in Microsoft Visual Studio, you have to create a Win32 project and select the application type DLL.
On 64-bit operating systems, Silk Performer uses a 64-bit process to analyze capture files and generate scripts. Thus, you have to build two versions of the conversion DLL: a 32-bit DLL, which is used for replaying scripts, and a 64-bit DLL, which is used for generating scripts. The 64-bit DLL has to be named <name of the 32-bit DLL>_x64.dll and located in the same directory as the 32-bit DLL.
Silk Performer has provided sample Microsoft Visual Studio projects with header and .cpp files that give you guidance on how to create your own custom conversion DLL. The samples are located at <public user documents>\Silk Performer <version>\SampleApps\SampleConversion.
If you reference the conversion DLL in a recording rule, you have to copy the DLL either into the Silk Performer recording rules directory or into the project directory. When developing the conversion DLL in Microsoft Visual Studio, you could copy the DLL to one of these directories (recording rules or project) in a post-build step or change the output directory path in the Release configuration to the recording rules directory.
You must export the conversion function with the following signature:
extern "C" { __declspec( dllexport ) long MyConversionFunction( LPCSTR sOriginalValue, LPSTR sConvertedValue, unsigned long* psConvertedValueLen, void* pReserved); }
The purpose of using C linkage (extern "C") is to turn off C++ name mangling of the exported function. If using C++ linkage, other information like the types of arguments would be put into the exported name of the function. Use the "pure" function name as the exported function name (this is MyConversionFunction in the example above).
sOriginalValue | The MBCS string value that has to be converted. |
sConvertedValue | The string buffer that receives the converted value as MBCS string. |
psConvertedValueLen | Points to a variable which contains the length of the string buffer sConvertedValue. This variable’s value has to be set to the number of bytes written to sConvertedValue if the conversion succeeded. This variable value has to be set to the number of bytes required for the converted value if the size of the string buffer sConvertedValue is too small. |
pReserved | Reserved for future usage. |
Return value |
|