Last active
March 7, 2017 22:13
-
-
Save ScatteredRay/357686427c7101e4edf9275b2e51defe to your computer and use it in GitHub Desktop.
Circular dll build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "Foo.h" | |
#include "Baz.h" | |
#undef API | |
#define API __declspec(dllexport) | |
#include "Bar.h" | |
void Bar::Print() { | |
printf("Bar\n"); | |
} | |
void Bar::PrintDeps() { | |
Foo::Print(); | |
Baz::Print(); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef API | |
#define API __declspec(dllimport) | |
#endif | |
struct Bar { | |
static void API Print(); | |
static void API PrintDeps(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "Foo.h" | |
#include "Bar.h" | |
#undef API | |
#define API __declspec(dllexport) | |
#include "Baz.h" | |
void Baz::Print() { | |
printf("Baz\n"); | |
} | |
void Baz::PrintDeps() { | |
Foo::Print(); | |
Bar::Print(); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef API | |
#define API __declspec(dllimport) | |
#endif | |
struct Baz { | |
static void API Print(); | |
static void API PrintDeps(); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REM cl * /c generates .obj | |
REM lib * /DEF generates .exp and dynamic export .libs | |
REM cl * generates the .exe | |
REM cl * /LD generates a .dll | |
cl Foo.cpp /c | |
cl Bar.cpp /c | |
lib Bar.obj /DEF | |
cl Baz.cpp /c | |
lib Baz.obj /DEF | |
cl Foo.obj Baz.lib Bar.lib | |
cl /LD Baz.obj Bar.lib Foo.lib | |
cl /LD Bar.obj Baz.lib Foo.lib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include "Bar.h" | |
#include "Baz.h" | |
#undef API | |
#define API __declspec(dllexport) | |
#include "Foo.h" | |
void Foo::Print() { | |
printf("Foo\n"); | |
} | |
void Foo::PrintDeps() { | |
Bar::Print(); | |
Baz::Print(); | |
} | |
int main(int argc, char** argv) { | |
Foo::PrintDeps(); | |
Bar::PrintDeps(); | |
Baz::PrintDeps(); | |
} | |
< |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef API | |
#define API __declspec(dllimport) | |
#endif | |
struct Foo { | |
static void API Print(); | |
static void API PrintDeps(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment