37 lines
591 B
C++
Raw Normal View History

2014-09-16 22:42:47 +03:00
#include "interface/module.h"
2014-09-16 23:14:04 +03:00
#include "interface/server.h"
2014-09-16 23:57:31 +03:00
#include <iostream>
2014-09-16 22:42:47 +03:00
2014-09-16 23:14:04 +03:00
struct Module: public interface::Module
2014-09-16 22:42:47 +03:00
{
interface::Server *m_server;
Module(interface::Server *server):
m_server(server)
2014-09-16 23:14:04 +03:00
{
2014-09-16 23:57:31 +03:00
std::cout<<"__loader construct"<<std::endl;
2014-09-16 23:14:04 +03:00
}
2014-09-16 22:42:47 +03:00
2014-09-16 23:14:04 +03:00
~Module()
{
2014-09-16 23:57:31 +03:00
std::cout<<"__loader destruct"<<std::endl;
2014-09-16 23:14:04 +03:00
}
2014-09-16 22:42:47 +03:00
void start()
{
2014-09-16 23:57:31 +03:00
m_server->load_module("test1", m_server->get_modules_path()+"/test1");
}
2014-09-16 23:14:04 +03:00
int test_add(int a, int b)
{
return a + b;
}
};
extern "C" {
2014-09-16 23:57:31 +03:00
EXPORT void* createModule___loader(interface::Server *server)
2014-09-16 22:42:47 +03:00
{
return (void*)(new Module(server));
2014-09-16 23:14:04 +03:00
}
2014-09-16 22:42:47 +03:00
}