www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20220] New: pragma (crt_constructor) does not work with

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

          Issue ID: 20220
           Summary: pragma (crt_constructor) does not work with CC=clang
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: erny.castell gmail.com

building this file:
////////////////
module crttest;
import core.stdc.stdio : printf;

pragma (crt_constructor)
extern(C) void constructor {
  printf("constructor called\n");
}

void main() {
  printf("main called\n");
}

with "CC=clang dmd crttest.d"

When I run the executable the output is:
   main called

instead of the expected:
   constructor called
   main called


also related to the same problem

--
Sep 17 2019