From 6a1f94b6f691f69ed6fe829333c9ac41a8a3efba Mon Sep 17 00:00:00 2001 From: Matthew Leach Date: Sun, 15 Sep 2019 12:56:00 +0100 Subject: [PATCH] [main] use for resolving -lm on linux machines As suggested by @cjwelborn in #16 the above header defines LIBM_SO which is what we should be using when opening -lm. Fixes: #17 --- src/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main.c b/src/main.c index 4bfa163..f49e6a2 100644 --- a/src/main.c +++ b/src/main.c @@ -11,6 +11,10 @@ #include "gc.h" #include "preprocess.h" +#if defined(BUILD_LINUX) + #include +#endif + extern FILE* cfilein; extern int cfileparse(); @@ -77,6 +81,11 @@ static int open_library(char *libname) char *tmp, *full_library_name; int ret; +#if defined(BUILD_LINUX) + if (!strcmp(libname, "m")) + libname = LIBM_SO; +#endif + /* First, attempt to open just the library, if it has been fully * specified. */ if (dlopen(libname, RTLD_NOW | RTLD_GLOBAL))