Using GCC's builtin alloca without the C standard library

Mike Franklin slavo5150 at yahoo.com
Mon Jul 23 01:35:02 UTC 2018


I'd like to be able to use GCC's `__builtin_alloca` without the C 
standard library.

This seems to work:

--- core/stdc/stdlib.d
module core.stdc.stdlib;
extern(C) void* alloca(size_t n) pure;
---

...but, since I'm not actually using the C standard library, I'd 
prefer to avoid creating that module hierarchy.


I tried simply adding...

--- {anyfile}.d
extern extern(C) void* __builtin_alloca(size_t size) pure;
---

... to my existing files, but I get an undefined reference for 
`__bulitin_alloca`.


LDC was pretty straightforward with:
--- {anyfile}.d
pragma(LDC_alloca)
void* alloca(size_t size) pure;
---

Is there a way to do something like that in GDC.  I don't care if 
I have to use `__builtin_alloca` or some other identifier, I just 
don't want to create the C standard library module hierarchy.

Thanks,
Mike


More information about the D.gnu mailing list