Re: core.stdc and betterC

2018-05-01 Thread dd86k via Digitalmars-d

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


Re: core.stdc and betterC

2018-04-30 Thread dd86k via Digitalmars-d

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.


Re: core.stdc and betterC

2018-04-30 Thread dd86k via Digitalmars-d

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.


Re: core.stdc and betterC

2018-04-29 Thread dd86k via Digitalmars-d

On Sunday, 29 April 2018 at 15:14:25 UTC, rikki cattermole wrote:

This issue has nothing to do with -betterC or extern(D).
You can get this same issue without it added if you don't link 
against phobos/druntime.


Oh heh I think you're right. It is only an issue when linking and 
by default it does link the C runtime, so I'll be fine making a 
source file externing everything myself. Didn't think of that, 
oops.




Re: core.stdc and betterC

2018-04-29 Thread dd86k via Digitalmars-d

On Sunday, 29 April 2018 at 15:40:20 UTC, Jacob Carlborg wrote:


I don't know why it was done this way. Perhaps it's just a 
macro on some platforms.


I think it's to better integrate with normal D code (thread 
safety, which explains the stdin is tagged with shared (TLS)).


It's all fine now. I'll type away my own bindings in a separate 
source file (stdc.d).


Re: core.stdc and betterC

2018-04-29 Thread dd86k via Digitalmars-d

On Sunday, 29 April 2018 at 14:55:06 UTC, rikki cattermole wrote:
I just checked, extern(D) isn't at fault. You actually do want 
name mangling for wrapper functions like that.


Re-externing what I need as C is wasted productivity, IMO.

Did you only -I the file? If you compile it in normally, it 
won't error out. Normally its compiled into druntime and hence 
Phobos.


Yeah, I am using core.stdc which _is_ from druntime indeed, but
the hint here is _stdc_ (and more specifically, _std_).

We really should have functions like this be templated (empty 
brackets) so that it'll work with just -I happily.


Really it's simply a betterC-related issue and thus why I
proposed the insertion of some version (D_betterC) here and
there.


Re: core.stdc and betterC

2018-04-29 Thread dd86k via Digitalmars-d

On Sunday, 29 April 2018 at 14:42:39 UTC, dd886k wrote:

Hello!


Embarrassingly enough, I just noticed I made a typo to my usual 
username.