Skip to content

Instantly share code, notes, and snippets.

@msmoiz
Created April 13, 2021 01:29
Show Gist options
  • Save msmoiz/7553e03e6609b29817b840767acbef8c to your computer and use it in GitHub Desktop.
Save msmoiz/7553e03e6609b29817b840767acbef8c to your computer and use it in GitHub Desktop.
Source and header files accompanying the Unrealistic.dev post on complex C++ compilation from the command line.
#include "static.h"
#include "shared.h"
#include <iostream>
void local_hello()
{
std::cout << "Hello local world!" << std::endl;
}
int main()
{
local_hello();
static_hello();
shared_hello();
}
#include "shared.h"
#include <iostream>
void shared_hello()
{
std::cout << "Hello shared world!" << std::endl;
}
#pragma once
#ifdef _WIN32
#ifdef EXPORTING
#define SHARED_API __declspec(dllexport)
#else
#define SHARED_API __declspec(dllimport)
#endif
#else
#define SHARED_API
#endif
SHARED_API void shared_hello();
#include "static.h"
#include <iostream>
void static_hello()
{
std::cout << "Hello static world!" << std::endl;
}
#pragma once
void static_hello();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment