feat: 用Boost.DLL从指定目录用加载动态链接库!

This commit is contained in:
2025-02-28 21:14:32 +08:00
commit c5204ba3a0
10 changed files with 150 additions and 0 deletions

View File

@ -0,0 +1,4 @@
command = shared_library('command', 'plugin.cpp',
dependencies : plugin_dep,
install : true,
install_dir : 'lib/loader')

View 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;
}
}

View 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;
}