Created new shared module build target type, and make sure -Wl,--no-undefined is not used when linking it.
parent
7afb4c6552
commit
6d84b9b646
6 changed files with 50 additions and 3 deletions
@ -0,0 +1,4 @@ |
||||
project('shared module', 'c') |
||||
|
||||
shared_module('mymodule', 'module.c') |
||||
|
@ -0,0 +1,22 @@ |
||||
#if defined _WIN32 || defined __CYGWIN__ |
||||
#define DLL_PUBLIC __declspec(dllexport) |
||||
#else |
||||
#if defined __GNUC__ |
||||
#define DLL_PUBLIC __attribute__ ((visibility("default"))) |
||||
#else |
||||
#pragma message ("Compiler does not support symbol visibility.") |
||||
#define DLL_PUBLIC |
||||
#endif |
||||
#endif |
||||
|
||||
/*
|
||||
* Shared modules often have references to symbols that are not defined |
||||
* at link time, but which will be provided by the executable that |
||||
* dlopens it. We need to make sure that this works, i.e. that we do |
||||
* not pass -Wl,--no-undefined when linking modules. |
||||
*/ |
||||
int nonexisting_function(); |
||||
|
||||
int DLL_PUBLIC func() { |
||||
return nonexisting_function(); |
||||
} |
Loading…
Reference in new issue