summaryrefslogtreecommitdiff
path: root/tests/modules/test2.cpp
blob: b07f0e3cae596a568b45c847c6ddc21322929d4d (plain)
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
#include "ModuleLoader.hpp"
#include "Base.hpp"
#include "Common.hpp"

#include <vector>
#include <string>
#include <iostream>

using namespace std;

int main( void )
{
	try {
		Common &c = Common::instance( );
		c.setName( "test2" );
		
		vector<string> modules;
#ifndef _WIN32
		modules.push_back( "./testmod2/mod_test2.so" );
#else
		modules.push_back( ".\\testmod2\\mod_test2.dll" );	
#endif
		ModuleLoader<Base> loader( modules );
		
		Base *obj = loader.create( "testmod2" );
		c.print( "hello from main" );
		obj->hello( );
		loader.destroy( obj );
		
	} catch( exception &e ) {
		cerr << "Module loader error: " << e.what( );
		return 1;
	}
	
	return 0;
}