From 808c5e28c0e8bc7a397eb2ffd1e77ee7a53061a6 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Wed, 30 Sep 2009 00:36:47 +0000 Subject: * driver/Makefile.in (open-axiom): Link against core runtime. * driver/main.c (publish_systemdir): Rework. * include/cfuns.h (oa_setenv): Declare. * lib/cfuns-c.c (oa_setenv): Define. --- src/driver/Makefile.in | 6 ++++-- src/driver/main.c | 15 ++------------- 2 files changed, 6 insertions(+), 15 deletions(-) (limited to 'src/driver') diff --git a/src/driver/Makefile.in b/src/driver/Makefile.in index f64cfab0..0141482e 100644 --- a/src/driver/Makefile.in +++ b/src/driver/Makefile.in @@ -1,4 +1,4 @@ -# Copyright (C) 2007-2008, Gabriel Dos Reis. +# Copyright (C) 2007-2009, Gabriel Dos Reis. # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -36,6 +36,8 @@ open_axiom_SOURCES = main.c utils.c open_axiom_objects = $(open_axiom_SOURCES:.c=.lo) +open_axiom_LDADD = -L$(axiom_target_libdir) $(oa_c_libs) + .PHONY: all all-ax all-driver all: all-ax @@ -59,7 +61,7 @@ utils.lo: utils.h main.lo: utils.h open-axiom$(EXEEXT): $(open_axiom_objects) - $(LINK) -o $@ $(open_axiom_objects) + $(LINK) -o $@ $(open_axiom_objects) $(open_axiom_LDADD) mostlyclean-local: @rm -f $(axiom_objects) diff --git a/src/driver/main.c b/src/driver/main.c index eb0a3dcb..14762979 100644 --- a/src/driver/main.c +++ b/src/driver/main.c @@ -51,21 +51,10 @@ static void publish_systemdir(const char* dir) { -#ifdef __WIN32__ - if (SetEnvironmentVariable(OPENAXIOM_GLOBAL_ENV, dir) == 0) { - perror("SetEnvironmentVariable"); + if (!oa_setenv(OPENAXIOM_GLOBAL_ENV, dir)) { + perror("publish_systemdir"); abort(); } -#else /* __WIN32__ */ - const int env_length = sizeof (OPENAXIOM_GLOBAL_ENV) - + 1 /* room for '=' */ - + strlen(dir); - char* env = (char*) malloc (env_length); - strcpy(env, OPENAXIOM_GLOBAL_ENV); - env[sizeof OPENAXIOM_GLOBAL_ENV - 1] = '='; - strcpy(env + sizeof(OPENAXIOM_GLOBAL_ENV), dir); - if (putenv(env) != 0) abort(); -#endif /* __WIN32__ */ } -- cgit v1.2.3