Don't compile library loading code on windows if it is disabled.

This commit is contained in:
Calvin Rose 2023-01-21 09:36:03 -06:00
parent 75179de8da
commit d8d1de2dcb
5 changed files with 17 additions and 6 deletions

View File

@ -1,6 +1,9 @@
# Changelog
All notable changes to this project will be documented in this file.
## ??? - Unreleased
- Add build-time detection for cygwin.
## 1.26.0 - 2023-01-07
- Add `ffi/malloc` and `ffi/free`. Useful as tools of last resort.
- Add `ffi/jitfn` to allow calling function pointers generated at runtime from machine code.

View File

@ -20,7 +20,7 @@
project('janet', 'c',
default_options : ['c_std=c99', 'build.c_std=c99', 'b_lundef=false', 'default_library=both'],
version : '1.26.0')
version : '1.26.1')
# Global settings
janet_path = join_paths(get_option('prefix'), get_option('libdir'), 'janet')

View File

@ -5,9 +5,9 @@
#define JANET_VERSION_MAJOR 1
#define JANET_VERSION_MINOR 26
#define JANET_VERSION_PATCH 0
#define JANET_VERSION_EXTRA ""
#define JANET_VERSION "1.26.0"
#define JANET_VERSION_PATCH 1
#define JANET_VERSION_EXTRA "-dev"
#define JANET_VERSION "1.26.1-dev"
/* #define JANET_BUILD "local" */

View File

@ -920,6 +920,13 @@ char *get_processed_name(const char *name) {
return ret;
}
#if defined(JANET_NO_DYNAMIC_MODULES)
const char *error_clib(void) {
return "dynamic modules not supported";
}
#else
#if defined(JANET_WINDOWS)
static char error_clib_buf[256];
@ -967,6 +974,7 @@ void *symbol_clib(HINSTANCE clib, const char *sym) {
}
}
#endif
#endif
/* Alloc function macro fills */

View File

@ -135,7 +135,7 @@ int janet_gettime(struct timespec *spec);
typedef int Clib;
#define load_clib(name) ((void) name, 0)
#define symbol_clib(lib, sym) ((void) lib, (void) sym, NULL)
#define error_clib() "dynamic libraries not supported"
const char *error_clib(void);
#define free_clib(c) ((void) (c), 0)
#elif defined(JANET_WINDOWS)
#include <windows.h>
@ -150,7 +150,7 @@ typedef void *Clib;
#define load_clib(name) dlopen((name), RTLD_NOW)
#define free_clib(lib) dlclose((lib))
#define symbol_clib(lib, sym) dlsym((lib), (sym))
#define error_clib() dlerror()
#define error_clib dlerror
#endif
char *get_processed_name(const char *name);