www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18055] New: exception handling cause EXC_BAD_ACCESS when

https://issues.dlang.org/show_bug.cgi?id=18055

          Issue ID: 18055
           Summary: exception handling cause EXC_BAD_ACCESS when linking
                    against shared libraries using vibe
           Product: D
           Version: D2
          Hardware: x86
                OS: Mac OS X
            Status: NEW
          Severity: blocker
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: timothee.cour2 gmail.com

I understand shared libraries are not 100% supported on OSX but they work to
some extent and fullfill a use case; could we make sure this particular case
works?
It's sad that such a fundamental feature (shared libraries) still don't work in
2017.

dmd --version
DMD64 D Compiler v2.077.0

dub build

.dylib
dmd -g -of=app libtest1.dylib main2.d

lldb ./app

(lldb) r
Process 85211 launched: './app' (x86_64)
Shared libraries are not yet supported on OSX.
ok1
Process 85211 stopped

(code=1, address=0x90)

libtest1.so`thread_stackBottom:
->  0x1002fcfd1 <+21>: movq   0x90(%rcx), %rdx
    0x1002fcfd8 <+28>: movq   (%rdx), %rax
    0x1002fcfdb <+31>: popq   %rbp
    0x1002fcfdc <+32>: retq
Target 0: (app) stopped.
(lldb) bt

(code=1, address=0x90)


libtest1.so`D4core7runtime19defaultTraceHandlerFPvZ16DefaultTraceInfo6__ctorMFZCQCpQCnQCiFQBqZQBr
+ 46

libtest1.so`D4core7runtime19defaultTraceHandlerFPvZC6object9Throwable9TraceInfo
+ 64




app`D3std9exception__T7bailOutHTC9ExceptionZQwFNaNfAyamxAaZv at exception.d:420

app`D3std9exception__T7enforceHTC9ExceptionTiZQyFNaNfiLAxaAyamZi at
exception.d:388



app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZ9__lambda1MFZv + 40

app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 32

app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFZv + 45

app`D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFMDFZvZv + 32






dub.json:
{
         "name": "test1",
         "targetType": "dynamicLibrary",
         "dependencies": {
                 "vibe-d": "==0.7.32",
         },
         "sourcePaths": [
                 "source/"
         ]
 }

source/app.d:
 module app;

 void fun(){
// uncomment to remove bug
         import vibe.vibe;
 }

main2.d:
 void test_throw2(){
         import std.exception;
         import std.stdio;
         writeln("ok1");
         try{
                 enforce(0);
         } catch(Exception t){
                 writeln("thrown");
         }
         writeln("ok2");
 }

 void main(){
         test_throw2;
 }

--
Dec 10 2017