mirror of
https://github.com/darlinghq/xcbuild.git
synced 2025-02-23 09:52:33 +00:00
[process] Don't use the constructor attribute on Linux
Using `__attribute__((constructor))` doesn't seem to get argc and argv as arguments with certain versions of the libc. On the other hand, using the `.init_array` section works so use that as a workaround until we can find a cleaner fix. h/t to @sas for this fix. This is a minimal fix for my problems when using xcbuild tools on my Linux machine. Fixes issue#138.
This commit is contained in:
parent
f9c9cebacb
commit
54a136e588
@ -128,13 +128,19 @@ executablePath() const
|
||||
static int commandLineArgumentCount = 0;
|
||||
static char **commandLineArgumentValues = NULL;
|
||||
|
||||
#if !defined(__linux__)
|
||||
__attribute__((constructor))
|
||||
#endif
|
||||
static void CommandLineArgumentsInitialize(int argc, char **argv)
|
||||
{
|
||||
commandLineArgumentCount = argc;
|
||||
commandLineArgumentValues = argv;
|
||||
}
|
||||
|
||||
#if defined(__linux__)
|
||||
__attribute__((section(".init_array"))) auto commandLineArgumentInitializer = &CommandLineArgumentsInitialize;
|
||||
#endif
|
||||
|
||||
std::vector<std::string> const &DefaultContext::
|
||||
commandLineArguments() const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user