[Issue 19640] Linker error when compiling delegate with betterC
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Dec 10 13:32:40 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=19640
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |razvan.nitu1305 at gmail.com
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
There are multiple issues with the code you've written. First of all you cannot
have a main function with betterC because dmd creates a d_run_main function
which is the entrypoint of d programs. Typically, you just create the object
file with betterC and then you link it with some C code. This is a minor
aspect, regarding the test code.
The main issue with the code is that the delegate (() => i) requires a closure
that is allocated with the GC. Since you are compiling with -betterC, the GC is
not available.
--
More information about the Digitalmars-d-bugs
mailing list