PathEngine home previous: Linking with the PathEngine DLLnext: Dynamic Linking on GCC Based Platforms
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 are loaded and executed by the testbed executable.

By default the testbed looks for an application named "TestApplication".
You can tell the testbed to load a different application 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.

On Windows, LoadLibrary() will add a '.dll' extension, if not already present, and will search the current directory, windows system directories and pathed directories for a dll with the specified name.
(See the MSDN documentation for LoadLibrary() for more details.)

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.

Running the Testbed on other platforms

The testbed is supplied as 32 bit and 64 bit Windows binaries, but can also be built from source for use on other platforms.
(See Building the TestBed for Other Platforms for more information.)

Testbed command line arguments

Testbed command line arguments can be accessed by the client dll with iTestBed::getNumberOfCommandLineArguments() and iTestBed::getCommandLineArgument().

Requirements, and other information about working with the Testbed

For requirements, and other information about working with the Testbed, see Working with the TestBed.


Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: Dynamic Linking on GCC Based Platforms