C linkage is fun

2012-05-24 Thread Alex Rønne Petersen
Just a little gotcha I ran into today: import core.memory; extern (C) void gc_collect() { assert(false, nope!); } void main() { GC.collect(); } -- Alex Rønne Petersen a...@lycus.org http://lycus.org

Re: C linkage is fun

2012-05-24 Thread Alex Rønne Petersen
On 24-05-2012 14:06, Alex Rønne Petersen wrote: Just a little gotcha I ran into today: import core.memory; extern (C) void gc_collect() { assert(false, nope!); } void main() { GC.collect(); } BTW, this is particularly fun if your gc_collect function has arguments and tries to read those!

Re: C linkage is fun

2012-05-24 Thread Robert Clipsham
On 24/05/2012 13:06, Alex Rønne Petersen wrote: Just a little gotcha I ran into today: import core.memory; extern (C) void gc_collect() { assert(false, nope!); } void main() { GC.collect(); } I believe this is by design - the linker will only look for gc_collect() in a library if it isn't

Re: C linkage is fun

2012-05-24 Thread Paulo Pinto
On Thursday, 24 May 2012 at 12:18:14 UTC, Robert Clipsham wrote: On 24/05/2012 13:06, Alex Rønne Petersen wrote: Just a little gotcha I ran into today: import core.memory; extern (C) void gc_collect() { assert(false, nope!); } void main() { GC.collect(); } I believe this is by design -