feat: 用Boost.DLL从指定目录用加载动态链接库!
This commit is contained in:
4
plugins/command/meson.build
Normal file
4
plugins/command/meson.build
Normal file
@ -0,0 +1,4 @@
|
||||
command = shared_library('command', 'plugin.cpp',
|
||||
dependencies : plugin_dep,
|
||||
install : true,
|
||||
install_dir : 'lib/loader')
|
17
plugins/command/plugin.cpp
Normal file
17
plugins/command/plugin.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include "plugin.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
using std::string;
|
||||
|
||||
namespace loader {
|
||||
|
||||
const string Command::name() const {
|
||||
return "command";
|
||||
}
|
||||
Command::~Command() {
|
||||
std::cout << "destructing command" << std::endl;
|
||||
}
|
||||
|
||||
}
|
18
plugins/command/plugin.hpp
Normal file
18
plugins/command/plugin.hpp
Normal file
@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "interface.hpp"
|
||||
|
||||
namespace loader {
|
||||
|
||||
class Command : public Interface {
|
||||
public:
|
||||
const std::string name() const;
|
||||
~Command();
|
||||
};
|
||||
|
||||
extern "C" BOOST_SYMBOL_EXPORT Command plugin;
|
||||
Command plugin;
|
||||
|
||||
}
|
Reference in New Issue
Block a user