Loading External Data Into Common

Loading external data into common can be done with the code below. This code will be executed exactly once when the method dll is first loaded. The data will remain resident and unchanged until you exit the program. It differs from a Decoder Static in that it won’t be re-initialized every time you start capturing or load a new capture file.

COMMON

//Some Data Declaration

extern "C" declspec(dllexport) void InitMthDll(HINSTANCE hInstance, DWORD dwReason)

{

if(dwReason == DLL_PROCESS_ATTACH)

{

TCHAR szDllPath[MAX_PATH];

int iNumOfBackSlashes = 0;

int iLength = GetModuleFileName(hInstance, szDllPath, MAX_PATH);

if(iLength != 0)

{

// read some external data source and save it to COMMON data.

}

}

}

ENDCOMMON