summaryrefslogtreecommitdiff
path: root/tests/modules/test4.cpp
blob: 563096631b2c2950dd0733e60e494cbc21e7d756 (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
37
38
39
40
#include "ModuleLoader.hpp"
#include "Base.hpp"
#include "Common.hpp"
#include "UserData.hpp"

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

using namespace std;

int main( void )
{
	try {
		Common &c = Common::instance( );
		c.setName( "test4" );

		vector<string> modules;
#ifndef _WIN32
		modules.push_back( "./testmod4/mod_test4.so" );
#else
		modules.push_back( ".\\testmod4\\mod_test4.dll" );	
#endif
		UserData user_data;
		user_data.version = 47;
		user_data.text.assign( "hello there" ); 
		ModuleLoader<Base> loader( modules, DEFAULT_FLAGS, (void *)&user_data );
		
		Base *obj = loader.create( "testmod4" );
		c.print( "hello from main" );
		obj->hello( );
		loader.destroy( obj );
		
	} catch( exception &e ) {
		cerr << "Module loader error: " << e.what( );
		return 1;
	}
	
	return 0;
}