C linkage is fun
Robert Clipsham
robert at octarineparrot.com
Thu May 24 05:18:13 PDT 2012
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 found in object files you provide.
This can be quite useful if you ever need to replace an internal
function of something, it can easily go wrong though if your build
process changes for some reason (or any number of other reasons!)
--
Robert
http://octarineparrot.com/
More information about the Digitalmars-d
mailing list