| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
January 04, 2016 [Issue 15514] Segfault when calling valid D code from C | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15514 --- Comment #1 from Puneet Goel <puneet@coverify.org> --- (In reply to Puneet Goel from comment #0) > Created attachment 1571 [details] > D and C code files along with makefile > > Trying to call D code from C is resulting in segfault. Kindly see the attachment to look at the code that segfaults. -- | ||||
January 04, 2016 [Issue 15514] Segfault when calling valid D code from C | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15514 ag0aep6g@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ag0aep6g@gmail.com --- Comment #2 from ag0aep6g@gmail.com --- Reduced the test case a little: main.c: ---- extern void initialize(); int main(int argc, char*argv[]) { initialize(); return 0; } ---- foo.d: ---- extern(C) void initialize() { import core.runtime; Runtime.initialize; int x; auto dg = {x = 2;}; Runtime.terminate(); } ---- Compiling and running: ---- $ gcc -c main.c $ dmd foo.d main.o $ ./foo Segmentation fault (core dumped) ---- -- | ||||
January 04, 2016 [Issue 15514] Segfault when calling valid D code from C | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15514 --- Comment #3 from ag0aep6g@gmail.com --- I think the problem is that the memory for the closure is allocated as soon as the initialize function is entered, i.e. before the call to Runtime.initialize. -- | ||||
October 28, 2022 [Issue 15514] Segfault when calling valid D code from C | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=15514 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |WORKSFORME --- Comment #4 from RazvanN <razvan.nitu1305@gmail.com> --- I cannot reproduce this example. Compiling the reduced test case and running it now leads to graceful program exit. -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply