parent
79208fd9c4
commit
d152c1b5d5
8 changed files with 110 additions and 1 deletions
@ -0,0 +1,7 @@ |
||||
#define BUILDING_DLL |
||||
|
||||
#include<mylib.h> |
||||
|
||||
int func2() { |
||||
return 42; |
||||
} |
@ -0,0 +1,7 @@ |
||||
#define BUILDING_DLL |
||||
|
||||
#include<mylib.h> |
||||
|
||||
int func1() { |
||||
return 42; |
||||
} |
@ -0,0 +1,14 @@ |
||||
project('whole archive', 'c') |
||||
|
||||
stlib = static_library('allofme', 'libfile.c') |
||||
|
||||
# Nothing in dylib.c uses func1, so the linker would throw it |
||||
# away and thus linking the exe would fail. |
||||
dylib = shared_library('shlib', 'dylib.c', |
||||
link_whole : stlib) |
||||
|
||||
exe = executable('prog', 'prog.c', |
||||
link_with : dylib) |
||||
|
||||
test('prog', exe) |
||||
|
@ -0,0 +1,21 @@ |
||||
#pragma once |
||||
|
||||
/* Both funcs here for simplicity. */ |
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__ |
||||
#if defined BUILDING_DLL |
||||
#define DLL_PUBLIC __declspec(dllexport) |
||||
#else |
||||
#define DLL_PUBLIC __declspec(dllimport) |
||||
#endif |
||||
#else |
||||
#if defined __GNUC__ |
||||
#define DLL_PUBLIC __attribute__ ((visibility("default"))) |
||||
#else |
||||
#pragma message ("Compiler does not support symbol visibility.") |
||||
#define DLL_PUBLIC |
||||
#endif |
||||
#endif |
||||
|
||||
int DLL_PUBLIC func1(); |
||||
int DLL_PUBLIC func2(); |
@ -0,0 +1,5 @@ |
||||
#include<mylib.h> |
||||
|
||||
int main(int argc, char **argv) { |
||||
return func1() - func2(); |
||||
} |
Loading…
Reference in new issue