www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19461] New: Function literals can't be extern(C)

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

          Issue ID: 19461
           Summary: Function literals can't be extern(C)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

https://dlang.org/spec/expression.html#function_literals

Unfortunately, they can't be extern(C), and if attempted there is no compiler
or linker error to warn the user about the ABI incompatilibity. Using the
parameters just won't work and there's no way to fix it.

This shows up in, say, attempting to use function literals as the function
pointer value for a Python extension implemented in D. An extern(C) function
has to be written/generated just to fix the ABI of calling it.

--
Dec 03 2018