修改框架为DLL发布
This commit is contained in:
23
src/core/entry.cpp
Normal file
23
src/core/entry.cpp
Normal 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
5
src/core/entry.h
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
extern "C" {
|
||||
__declspec(dllexport) int fastweb(const char* config_filepath);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user