www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20925] New: pragma(inline) should emit code to the calling CU


          Issue ID: 20925
           Summary: pragma(inline) should emit code to the calling CU +
                    appropriate linker flags
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: turkeyman gmail.com

inline functions should be emit to the calling CU.

they should be assigned an appropriate link flag such that linker appropriately
handles duplicate symbols:
  inline = 'linkonce'          (like `inline` in C)
  private inline = 'internal'  (like `static inline` in C)

ie; LLVM enumerates the linker flags:

Specifically, this should work:

module lib;
pragma(inline, true)
void inl() {}

import lib;

int main()
    return 0;



 dmd test.d
No link error! Currently:
 error LNK2019: unresolved external symbol "void lib.inl()" (__D3lib3inlFZv)
referenced in function __Dmain
Jun 12 2020