summaryrefslogtreecommitdiff
path: root/MLKInterpreter.m
diff options
context:
space:
mode:
Diffstat (limited to 'MLKInterpreter.m')
-rw-r--r--MLKInterpreter.m26
1 files changed, 12 insertions, 14 deletions
diff --git a/MLKInterpreter.m b/MLKInterpreter.m
index a2aa81e..a98fb41 100644
--- a/MLKInterpreter.m
+++ b/MLKInterpreter.m
@@ -38,18 +38,21 @@
#import "util.h"
#import <Foundation/NSArray.h>
+#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSException.h>
#import <Foundation/NSNull.h>
#import <Foundation/NSString.h>
-#ifndef _WIN32
-#include <dlfcn.h>
+#include <stdio.h>
+
+#ifdef _WIN32
+ #include <windows.h>
#else
-#include <windows.h>
+ #define _BSD_SOURCE
+ #undef _POSIX_C_SOURCE // needed at least on Mac OS X for RTLD_DEFAULT to be defined
+ #include <dlfcn.h>
#endif
-#include <stdio.h>
-
static MLKPackage *cl;
static MLKPackage *sys;
@@ -501,18 +504,13 @@ static MLKSymbol *MULTIPLE_VALUE_CALL;
//EnumProcessModules (...);
//GetProcAddress (..., [name UTF8String]);
#else
-#ifdef linux
function = dlsym (RTLD_DEFAULT, [name UTF8String]);
-#else
- // FIXME
- function = dlsym (NULL, [name UTF8String]);
-#endif
#endif
- return LAUTORELEASE ([[MLKForeignProcedure alloc]
- initWithCode:function
- argumentTypes:[argtypes array]
- returnType:returnType]);
+ RETURN_VALUE (LAUTORELEASE ([[MLKForeignProcedure alloc]
+ initWithCode:function
+ argumentTypes:[argtypes array]
+ returnType:returnType]));
}
else if (car == FUNCTION)
{