mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 06:39:17 +02:00
adding dll fixes for mingw
This commit is contained in:
parent
3123d48da7
commit
a630d84413
3 changed files with 24 additions and 2 deletions
6
Makefile
6
Makefile
|
@ -24,6 +24,9 @@ GENSTATIC ?= ./tools/genstatic.scm
|
||||||
# system configuration - if not using GNU make, set PLATFORM and the
|
# system configuration - if not using GNU make, set PLATFORM and the
|
||||||
# following flags as necessary.
|
# following flags as necessary.
|
||||||
|
|
||||||
|
#
|
||||||
|
LIBDL = -ldl
|
||||||
|
|
||||||
ifndef PLATFORM
|
ifndef PLATFORM
|
||||||
ifeq ($(shell uname),Darwin)
|
ifeq ($(shell uname),Darwin)
|
||||||
PLATFORM=macosx
|
PLATFORM=macosx
|
||||||
|
@ -52,6 +55,7 @@ CLIBFLAGS = -shared
|
||||||
CPPFLAGS += -DSEXP_USE_STRING_STREAMS=0 -DBUILDING_DLL -DSEXP_USE_DEBUG=0
|
CPPFLAGS += -DSEXP_USE_STRING_STREAMS=0 -DBUILDING_DLL -DSEXP_USE_DEBUG=0
|
||||||
LDFLAGS += -Wl,--out-implib,libchibi-scheme$(SO).a
|
LDFLAGS += -Wl,--out-implib,libchibi-scheme$(SO).a
|
||||||
STATICFLAGS = -DSEXP_USE_DL=0
|
STATICFLAGS = -DSEXP_USE_DL=0
|
||||||
|
LIBDL =
|
||||||
else
|
else
|
||||||
SO = .so
|
SO = .so
|
||||||
EXE =
|
EXE =
|
||||||
|
@ -76,7 +80,7 @@ ifeq ($(SEXP_USE_DL),0)
|
||||||
XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -lm
|
XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -lm
|
||||||
XCFLAGS := -Wall -DSEXP_USE_DL=0 -g3 $(CFLAGS)
|
XCFLAGS := -Wall -DSEXP_USE_DL=0 -g3 $(CFLAGS)
|
||||||
else
|
else
|
||||||
XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) -ldl -lm
|
XLDFLAGS := $(LDFLAGS) $(GCLDFLAGS) $(LIBDL) -lm
|
||||||
XCFLAGS := -Wall -g3 $(CFLAGS)
|
XCFLAGS := -Wall -g3 $(CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
18
eval.c
18
eval.c
|
@ -2039,7 +2039,22 @@ void sexp_warn_undefs (sexp ctx, sexp from, sexp to, sexp out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SEXP_USE_DL
|
#if SEXP_USE_DL
|
||||||
sexp sexp_load_dl (sexp ctx, sexp file, sexp env) {
|
#ifdef __MINGW32__
|
||||||
|
#include <windows.h>
|
||||||
|
static sexp sexp_load_dl (sexp ctx, sexp file, sexp env) {
|
||||||
|
sexp_proc2 init;
|
||||||
|
HINSTANCE handle = LoadLibraryA(sexp_string_data(file));
|
||||||
|
if(!handle)
|
||||||
|
return sexp_compile_error(ctx, "couldn't load dynamic library", file);
|
||||||
|
init = (sexp_proc2) GetProcAddress(handle, "sexp_init_library");
|
||||||
|
if(!init) {
|
||||||
|
FreeLibrary(handle);
|
||||||
|
return sexp_compile_error(ctx, "dynamic library has no sexp_init_library", file);
|
||||||
|
}
|
||||||
|
return init(ctx, env);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
static sexp sexp_load_dl (sexp ctx, sexp file, sexp env) {
|
||||||
sexp_proc2 init;
|
sexp_proc2 init;
|
||||||
void *handle = dlopen(sexp_string_data(file), RTLD_LAZY);
|
void *handle = dlopen(sexp_string_data(file), RTLD_LAZY);
|
||||||
if (! handle)
|
if (! handle)
|
||||||
|
@ -2052,6 +2067,7 @@ sexp sexp_load_dl (sexp ctx, sexp file, sexp env) {
|
||||||
return init(ctx, env);
|
return init(ctx, env);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
sexp sexp_load (sexp ctx, sexp source, sexp env) {
|
sexp sexp_load (sexp ctx, sexp source, sexp env) {
|
||||||
#if SEXP_USE_DL
|
#if SEXP_USE_DL
|
||||||
|
|
|
@ -18,8 +18,10 @@ extern "C" {
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if SEXP_USE_DL
|
#if SEXP_USE_DL
|
||||||
|
#ifndef __MINGW32__
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PLAN9
|
#ifdef PLAN9
|
||||||
#include <u.h>
|
#include <u.h>
|
||||||
|
|
Loading…
Add table
Reference in a new issue