Skip to content

Commit

Permalink
[build] Touch-ups to the shared library build
Browse files Browse the repository at this point in the history
  • Loading branch information
pajama-coder committed May 20, 2024
1 parent b19c53f commit 9d95a7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,17 +380,10 @@ static SignalHandler s_signal_handler;
//
// Program entrance
//
#ifndef PIPY_SHARED
int main(int argc, char *argv[]) {
#else
#ifdef _WIN32
#define PIPY_API __declspec(dllexport)
#else
#define PIPY_API
#endif

extern "C" PIPY_API int pipy_main(int argc, char *argv[]) {
#endif
extern "C" PIPY_API
int pipy_main(int argc, char *argv[]) {

int exit_code = 0;

try {
Expand Down Expand Up @@ -689,3 +682,11 @@ extern "C" PIPY_API int pipy_main(int argc, char *argv[]) {

return exit_code;
}

#ifndef PIPY_SHARED

int main(int argc, char *argv[]) {
return pipy_main(argc, argv);
}

#endif // !PIPY_SHARED
4 changes: 4 additions & 0 deletions src/os-platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ auto process_id() -> int;

#ifdef _WIN32

#define PIPY_API __declspec(dllexport)

#include <Windows.h>
#include <UserEnv.h>

Expand Down Expand Up @@ -103,6 +105,8 @@ auto get_last_error() -> std::string;

#else // !_WIN32

#define PIPY_API

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
Expand Down

0 comments on commit 9d95a7f

Please sign in to comment.