summaryrefslogtreecommitdiff
path: root/utils/vtex/vtex_launcher.cpp
blob: cd1842f8de1262d7492e65bcc30d7ee9920e8adf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#include <stdio.h>
#include "tier1/interface.h"
#include "ilaunchabledll.h"


int main( int argc, char **argv )
{
	const char *pModuleName = "vtex_dll.dll";
	
	CSysModule *pModule = Sys_LoadModule( pModuleName );
	if ( !pModule )
	{
		printf( "Can't load %s.", pModuleName );
		return 1;
	}

	CreateInterfaceFn fn = Sys_GetFactory( pModule );
	if ( !fn )
	{
		printf( "Can't get factory from %s.", pModuleName );
		Sys_UnloadModule( pModule );
		return 1;
	}

	ILaunchableDLL *pInterface = (ILaunchableDLL*)fn( LAUNCHABLE_DLL_INTERFACE_VERSION, NULL );
	if ( !pInterface )
	{
		printf( "Can't get '%s' interface from %s.", LAUNCHABLE_DLL_INTERFACE_VERSION, pModuleName );
		Sys_UnloadModule( pModule );
		return 1;
	}

	int iRet = pInterface->main( argc, argv );
	Sys_UnloadModule( pModule );
	return iRet;
}