From babddbce4ebdfca5ec9b5af78ba08ca08c50a9c0 Mon Sep 17 00:00:00 2001 From: dansanduleac Date: Thu, 2 Jun 2011 17:58:01 +0100 Subject: [PATCH] Added support for using 32-bit DMD2 on Mac OS X. --- dcompiler.py | 10 ++++++++++ infrastructure/d/python_so_darwin_boilerplate.d | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dcompiler.py b/dcompiler.py index 86e2018..4af196d 100644 --- a/dcompiler.py +++ b/dcompiler.py @@ -438,6 +438,16 @@ def _initialize(self): # StackThreads support self._st_support = True + # link with the relevant python libraries + if _isPlatMac: + frameworkSearchPath = sys.prefix[:sys.prefix.find('Python.framework')-1] + self._linkOpts += ['-L-F'+frameworkSearchPath, '-L-framework', '-LPython'] + pass + else: + # TODO only if linux + #self._linkOpts = [self.library_option('python')] + pass + #def link_opts(self, def _def_file(self, output_dir, output_filename): diff --git a/infrastructure/d/python_so_darwin_boilerplate.d b/infrastructure/d/python_so_darwin_boilerplate.d index b1c7cb3..84cdaf8 100644 --- a/infrastructure/d/python_so_darwin_boilerplate.d +++ b/infrastructure/d/python_so_darwin_boilerplate.d @@ -7,13 +7,15 @@ extern (C) void _moduleDtor(); extern (C) void _moduleUnitTests(); -pragma(attribute, constructor) void _init() { +version(GNU) { pragma(attribute, constructor) } +void _init() { gc_init(); //_moduleCtor(); // XXX PI does not work here... moded in PydMain //_moduleUnitTests(); // idem } -pragma(attribute, destructor) void _fini() { +version(GNU) { pragma(attribute, destructor) } +void _fini() { _moduleDtor(); gc_term(); }