Building LDC runtime for a microcontroller

Remi remigillig at gmail.com
Wed Sep 16 17:59:41 UTC 2020


On Monday, 7 September 2020 at 22:13:20 UTC, Adam D. Ruppe wrote:
> On Monday, 7 September 2020 at 20:55:54 UTC, IGotD- wrote:
>> I guess this was written before betterC existed.
>
> Well, -betterC existed even then, but it was *completely* 
> useless. It didn't become useful until 2016 or 2017.
>
> But around that same time, going minimal runtime got even 
> easier, so I never really got on the betterC train anyway. On 
> my tetris webassembly thing last month, I went with a minimal 
> druntime 
> http://dpldocs.info/this-week-in-d/Blog.Posted_2020_08_10.html#druntime
>
> And it has some class support too in not a lot of code: 
> https://github.com/adamdruppe/webassembly/blob/master/arsd-webassembly/object.d
>
> (and if you aren't doing classes and built-in arrays, you can 
> cut a bunch of that out too).
>
>> To be honest I like this approach better as it opens up for 
>> gradually adding functionality.
>
> Yes, indeed.
>
> betterC is nice that it gives a library community a shared 
> target to rally around, but for your own custom application it 
> is probably better to do your own thing (though betterC might 
> work for you too, worth considering at least).

I tried to modify the hello.d example from your blog post. It 
works without changes but when I tried to do a string 
concatenation, I'm hitting linker errors related to TypeInfo:

	lld: error: server/omg.o: undefined symbol: 
_D12TypeInfo_Aya6__initZ

Using this in hello.d

	string tmp = "hello";
	tmp ~= " world !";
	writeln(tmp);

I've hit this when trying to make a minimal runtime like yours 
but I couldn't figure out from the LDC source how that happens. 
Would you be able to help me understand how to solve this __init 
symbol issue? Thanks.

- Remi.


More information about the Digitalmars-d-learn mailing list