PathEngine home previous: Interface Version Numbersnext: Linking with the PathEngine DLL
Contents, Programmers Guide, Linking with the SDK, Linking with the TestBed

Linking with the TestBed

Applications running against the PathEngine testbed are built as dlls which then get loaded and executed by the testbed executable.

By default the testbed looks for a dll named "testapplication.dll" in the same directory as the testbed exe.
If a dll with this name is not found in this directory then the current directory, windows system directories and pathed directories are searched. (See the documentation for LoadLibrary in MSDN for details about this search order.)

You can tell the testbed to load a different dll by passing a command line parameter 'app=dllname' (where dllname indicates the name of the dll to load).
You can also specify relative or absolute paths with this parameter.

The testbed looks for the following entrypoint within this dll:

extern "C"
{
	__declspec(dllexport) void __stdcall TestApplicationEntryPoint(iPathEngine* pathengine, iTestBed* testbed);
}

The test application must use the interface to PathEngine passed in to this entry point as opposed to loading the PathEngine dll explicitly.
It is important to check the interface version numbers for the interfaces passed in to the entrypoint.
This ensures that the interfaces provided by the testbed are binary compatible with the headers used to compile the test application. (See Interface Version Numbers.)

The resulting code at the entrypoint should look something like this:

extern "C"
{
	__declspec(dllexport) void __stdcall TestApplicationEntryPoint(
											iPathEngine *pathengine, iTestBed *testbed)
	{	 		
	// check if interfaces are compatible with the headers used for compilation
		if(testbed->getInterfaceMajorVersion()!=TESTBED_INTERFACE_MAJOR_VERSION
			||
			testbed->getInterfaceMinorVersion()<TESTBED_INTERFACE_MINOR_VERSION)
		{
			testbed->reportError("Fatal","TestApplication: testbed version is incompatible with headers used for compilation.",0);
			return;
		}
		if(pathengine->getInterfaceMajorVersion()!=PATHENGINE_INTERFACE_MAJOR_VERSION
			||
			pathengine->getInterfaceMinorVersion()<PATHENGINE_INTERFACE_MINOR_VERSION)
		{
			testbed->reportError("Fatal","TestApplication: pathengine version is incompatible with headers used for compilation.",0);
			return;
		}

		// use the interfaces..
	}
}

TESTBED_INTERFACE_MAJOR_VERSION and TESTBED_INTERFACE_MINOR_VERSION are defined in i_testbed.h.


Documentation for PathEngine release 5.16 - Copyright © 2002-2008 PathEnginenext: Linking with the PathEngine DLL