entry.cpp 689 B

123456789101112131415161718192021222324252627282930313233
  1. #include <iostream>
  2. #include "core/app.h"
  3. #include "util/system.h"
  4. #include "core/define.h"
  5. #include "core/config.h"
  6. #include "entry.h"
  7. extern "C" {
  8. #ifdef _WIN32
  9. DLL_EXPORT
  10. #endif
  11. void* fastweb_start(const char* config_filepath)
  12. {
  13. fastweb::app* app = new fastweb::app();
  14. if (app->start(config_filepath) == false)
  15. {
  16. app->log->error("fastweb start failed," + app->last_error(), __FILE__, __func__, __LINE__);
  17. delete app;
  18. return nullptr;
  19. }
  20. app->log->success("success", __FILE__, __func__, __LINE__);
  21. return app;
  22. }
  23. #ifdef _WIN32
  24. DLL_EXPORT
  25. #endif
  26. void fastweb_close(void* app)
  27. {
  28. auto a = static_cast<fastweb::app*>(app);
  29. a->stop();
  30. delete a;
  31. }
  32. }