修改框架为DLL发布

This commit is contained in:
xx
2024-05-28 18:28:11 +08:00
parent d203466193
commit 0fc030a3cf
5 changed files with 118 additions and 90 deletions

23
src/core/entry.cpp Normal file
View File

@@ -0,0 +1,23 @@
#include <iostream>
#include "core/fastweb.h"
#include "util/system.h"
#include "core/define.h"
#include "core/config.h"
extern "C" {
__declspec(dllexport) int fastweb(const char* config_filepath)
{
std::cout << "=========== [fastweb engine] ============" << std::endl;
if (sConfig->open(config_filepath) == false)
{
LOG_ERROR("open config failed," + sConfig->last_error());
return -1;
}
if (fastweb::getInstance()->start() == false)
{
LOG_ERROR("fastweb start failed," + fastweb::getInstance()->last_error());
return -1;
}
return 0;
}
}

5
src/core/entry.h Normal file
View File

@@ -0,0 +1,5 @@
extern "C" {
__declspec(dllexport) int fastweb(const char* config_filepath);
}

View File

@@ -1,28 +0,0 @@
#pragma once
#include <iostream>
#include "core/fastweb.h"
#include "util/system.h"
#include "core/define.h"
#include "core/config.h"
int main()
{
std::cout << "=========== [fastweb engine] ============" << std::endl;
if(sConfig->open(system::current_dir() + "/config.ini") == false)
{
LOG_ERROR("open config failed,"+sConfig->last_error());
return -1;
}
if (fastweb::getInstance()->start() == false)
{
LOG_ERROR("fastweb start failed,"+fastweb::getInstance()->last_error());
return -1;
}
LOG_SUCC("success");
while (true)
std::cin.get();
return 0;
}