April 29, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On 4/29/2018 8:40 AM, Jacob Carlborg wrote:
> Looks like "putchar" is inlined [1]. That means the "putchar" you're
> referencing is not the one in the C standard library but it's
> implemented in druntime. That means you need to link with
> druntime/phobos, it's not enough to link with the C standard library.
>
> I don't know why it was done this way. Perhaps it's just a macro on some
> platforms.
>
> [1]
> https://github.com/dlang/druntime/blob/master/src/core/stdc/stdio.d#L1289
It is a macro on some platforms, and that's why it was done that way in core.stdc.stdio. These days, however, it is better to replace such macros with a template. That way it will not be necessary to link with druntime.
|
April 30, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jacob Carlborg | On Sunday, 29 April 2018 at 15:40:20 UTC, Jacob Carlborg wrote: > On 2018-04-29 16:42, dd886k wrote: >> [...] > > Looks like "putchar" is inlined [1]. That means the "putchar" you're referencing is not the one in the C standard library but it's implemented in druntime. That means you need to link with druntime/phobos, it's not enough to link with the C standard library. > > I don't know why it was done this way. Perhaps it's just a macro on some platforms. > > [1] https://github.com/dlang/druntime/blob/master/src/core/stdc/stdio.d#L1289 Yes, putchar is often implemented as a the macro #define putchar(x) putc(x, stdout) |
April 30, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On 2018-04-30 00:52, Walter Bright wrote: > It is a macro on some platforms, and that's why it was done that way in core.stdc.stdio. That makes sense. > These days, however, it is better to replace such macros with a template. That way it will not be necessary to link with druntime. That's a good idea. -- /Jacob Carlborg |
April 30, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Adam D. Ruppe | On Sunday, 29 April 2018 at 17:52:15 UTC, Adam D. Ruppe wrote: > BTW i haven't tried win32 functions with betterC. we should - and they should generally work, though the struct inits might cause linker errors in some cases. Windows isn't the only one affected. Under CRuntime_Glibc (usually for Linux), std* and all are defined just like in CRuntime_Microsoft, which still make them unusable in a -betterC(-only) context. Or maybe I'm the only special guy who makes my projects betterC as a whole. > General tip btw: if you do see a linker error about "undefined symbol _Dsomething_init", you can probably just use `= void` when declaring the struct so it is not automatically initialized (so same behavior as C) and then memset it to 0 or whatever you need. Bless you! That was the last thing I needed to set for `_iob` (which in the Microsoft headers is set to _IOB_ENTRIES (20) and not _NFILE (512) (for FILE[*])), because I did cloned the Phobos repo and did modifications of my own, for my projects. |
April 30, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to dd86k | On Monday, 30 April 2018 at 21:51:13 UTC, dd86k wrote:
> Bless you! That was the last thing I needed to set for `_iob` (which in the Microsoft headers is set to _IOB_ENTRIES (20) and not _NFILE (512) (for FILE[*])), because I did cloned the Phobos repo and did modifications of my own, for my projects.
Oh huh, talked too fast. Still having access violations on x86mscoff.
|
April 30, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to dd86k | Please file all betterC issues with bugzilla and tag them with the 'betterC' keyword. We want to get them all fixed, and this makes it easy to find them! |
May 01, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Tuesday, 1 May 2018 at 00:34:55 UTC, Walter Bright wrote: > Please file all betterC issues with bugzilla and tag them with the 'betterC' keyword. We want to get them all fixed, and this makes it easy to find them! Hello Walter, I hope my first report[1] is properly done before I make other ones. [1] https://issues.dlang.org/show_bug.cgi?id=18816 |
May 02, 2018 Re: core.stdc and betterC | ||||
---|---|---|---|---|
| ||||
Posted in reply to dd86k | On 5/1/2018 3:42 PM, dd86k wrote:
> I hope my first report[1] is properly done before I make other ones.
>
> [1] https://issues.dlang.org/show_bug.cgi?id=18816
Yes, it's good, thanks!
|
Copyright © 1999-2021 by the D Language Foundation