Re: core.stdc and betterC

2018-04-29 Thread Patrick Schluter via Digitalmars-d

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)


Re: Is there some fast and @nogc capable binary search tree for D?

2018-04-29 Thread solidstate1991 via Digitalmars-d

On Monday, 30 April 2018 at 02:43:44 UTC, 12345swordy wrote:


If the data involved classes then the answer is no, as there is 
a bug regarding destroy as it involved external finalized c 
function. I'm writing a DIP draft that address this.


I think I can get around that by storing the data in dynamic 
arrays for the while I need them, then use the tree for quicker 
random access.


Re: Is there some fast and @nogc capable binary search tree for D?

2018-04-29 Thread Neia Neutuladh via Digitalmars-d

On Monday, 30 April 2018 at 02:21:37 UTC, solidstate1991 wrote:
Some components of my game engine would benefit from lookup 
trees. I tried to port one from Go, but either I messed up 
something bit that certain parts of the codes just won't 
execute for some reason, or the algorithm was poorly 
documented, and it will only optimize on one end of the binary 
search tree.


Looked around on dub, couldn't find anything that wouldn't 
introduce too much new dependencies or that was actually @nogc 
capable. I would be interested in some preexisting one, or some 
better documented ones from the web. All I can find is either 
very basic theory or things that already work well in my 
implementation, like indexing and insertion without 
optimization.


https://github.com/dlang-community/containers/blob/master/src/containers/ttree.d
 perhaps? It's only got one transitive dependency, and that's essentially a 
compatibility shim for people with old versions of D.


Re: Is there some fast and @nogc capable binary search tree for D?

2018-04-29 Thread 12345swordy via Digitalmars-d

On Monday, 30 April 2018 at 02:21:37 UTC, solidstate1991 wrote:
Some components of my game engine would benefit from lookup 
trees. I tried to port one from Go, but either I messed up 
something bit that certain parts of the codes just won't 
execute for some reason, or the algorithm was poorly 
documented, and it will only optimize on one end of the binary 
search tree.


Looked around on dub, couldn't find anything that wouldn't 
introduce too much new dependencies or that was actually @nogc 
capable. I would be interested in some preexisting one, or some 
better documented ones from the web. All I can find is either 
very basic theory or things that already work well in my 
implementation, like indexing and insertion without 
optimization.


If the data involved classes then the answer is no, as there is a 
bug regarding destroy as it involved external finalized c 
function. I'm writing a DIP draft that address this.


Is there some fast and @nogc capable binary search tree for D?

2018-04-29 Thread solidstate1991 via Digitalmars-d
Some components of my game engine would benefit from lookup 
trees. I tried to port one from Go, but either I messed up 
something bit that certain parts of the codes just won't execute 
for some reason, or the algorithm was poorly documented, and it 
will only optimize on one end of the binary search tree.


Looked around on dub, couldn't find anything that wouldn't 
introduce too much new dependencies or that was actually @nogc 
capable. I would be interested in some preexisting one, or some 
better documented ones from the web. All I can find is either 
very basic theory or things that already work well in my 
implementation, like indexing and insertion without optimization.


Passing to c++ std::string and vector

2018-04-29 Thread NewUser via Digitalmars-d-learn

Hi,

How do I pass a d string to a c++ std::string?

NewUser


[Issue 18804] std.algorithm.mutation.copy puts whole source range into target range when it should put elements

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18804

ag0aep6g  changed:

   What|Removed |Added

   Keywords||pull
 CC||ag0ae...@gmail.com
  Component|dmd |phobos
   Hardware|x86 |All
Summary|Side effects incorrectly|std.algorithm.mutation.copy
   |optimized out when results  |puts whole source range
   |are discarded   |into target range when it
   ||should put elements
 OS|Windows |All

--- Comment #1 from ag0aep6g  ---
Generally, please post complete code, including imports. Also include the
contents of other files like "in".

What happens here is that `copy` puts the range as a whole into the NullSink.
This is not DMD optimizing anything out.

Reduced test case:


import std.algorithm.mutation: copy;

struct NullSink
{
void put(E)(E) {}
}

int line = 0;

struct R
{
int front;
@property bool empty() { return line == 1; }
void popFront() { line = 1; }
}

void main()
{
R r;
copy(r, NullSink());
assert(line == 1); /* fails; should pass */
}


Pull request to fix this:
https://github.com/dlang/phobos/pull/6485

--


[Issue 14619] foreach implicitly slices ranges

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=14619

ag0aep6g  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=18807

--


[Issue 18807] RefRange behaves very differently for Input Ranges and Forward Ranges

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18807

ag0aep6g  changed:

   What|Removed |Added

 CC||ag0ae...@gmail.com
   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=14619

--- Comment #1 from ag0aep6g  ---
Possibly a duplicate of issue 14619.

--


Re: Whats wrong with the forum.dlang.org???

2018-04-29 Thread notna via Digitalmars-d
On Sunday, 29 April 2018 at 14:13:01 UTC, Vladimir Panteleev 
wrote:
On Sunday, 29 April 2018 at 13:14:35 UTC, Steven Schveighoffer 
wrote:
In the newsgroups, there was a post in March on "ost to pst 
convertes", which looks like it could have been flagged with 
spam (it no longer appears on the forum), with two "ad-like" 
responses, and a third is from notna, which looks more like a 
real response, even though it just has a URL in it. His 
history of posts that I've seen have been legitimate.


Yes, that's exactly it. It was a post in an off-topic thread 
with nothing but a link to a commercial product, so in fact it 
is indistinguishable from spam. It is also very similar to the 
common setup where someone posts an off-topic but otherwise 
unspammy question (generally seeking advice or a product 
recommendation), and is followed-up by actual spam. It was 
flagged by someone too, which is how it got deleted. All facts 
considered it's a bit hard to call this a false positive :)


notna: You are now unbanned, but I suggest to avoid doing this 
again.


Hi all.

Ok, understood, will not post "URLs only" in the future ;)

What is still strange 2 me... the forum was reachable for days 
after my mentioned post... AND I was banned then from home and 
also from our company networks, even after removing the cookies...


Nevertheless, let's say, the "banning" works pretty well, once 
someone decided to do it, but a little hint whom to contact to 
get un-banned in case of mis-banning would be helpful ;)


Thanks again



[Issue 18812] New: template enforce should accept same parameter combos as exception

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18812

  Issue ID: 18812
   Summary: template enforce should accept same parameter combos
as exception
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: elpenguin...@gmail.com

Currently, the enforce!SomeException form of enforce can use only msg/file/line
combinations. I believe this is an unnecessary restriction and this form of
enforce should be able to use any constructor for SomeException as long as
enforce's parameters match up - for example:

`
class SomeException : Exception {
uint somethingMeaningful;
this(uint a) {
somethingMeaningful = a;
super("Something went wrong!");
}
}

enforce!SomeException(false, 4);
`

Removing this restriction would be a HUGE usability improvement and would make
this much more viable in @nogc code.

--


Re: core.stdc and betterC

2018-04-29 Thread Walter Bright via Digitalmars-d

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.




Re: core.stdc and betterC

2018-04-29 Thread Kagamin 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.


At least ms, glibc and freebsd provide it as a function.


[Issue 18789] std.stdio messes up UTF conversions on output

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18789

--- Comment #2 from github-bugzi...@puremagic.com ---
Commit pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/d5cc4c5087a1819ac716cb5ea11d988fa667f822
fix conversion from wchar to char in LockingTextWriter.put

Fixes the easier part of issue 18789.

--


Re: core.stdc and betterC

2018-04-29 Thread Adam D. Ruppe via Digitalmars-d

On Sunday, 29 April 2018 at 15:52:11 UTC, dd86k wrote:
It's all fine now. I'll type away my own bindings in a separate 
source file (stdc.d).


You can also just do it in the usage module, for the individual 
functions you need. I do this a lot for various C libraries (and 
used to for the Win32 functions before they were included)


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.


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.


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 Jacob Carlborg via Digitalmars-d

On 2018-04-29 16:42, dd886k wrote:

Hello!

This is my first time posting, so do feel free to correct me and this post.

I started writing in D around Q2 2017 and recently been re-writing some 
of my projects as betterC (entirely!).


I noticed something weird. It started with DMD 2.074.0 and it's still an 
issue for me in DMD 2.079.1 (and any other compiler really).


Consider this piece:

```
import core.stdc.stdio;

extern(C) void main() {
 printf("a");
}
```

It compiles and runs absolutely wonderful (OMF, MSCOFF, ELF, etc.). No 
issues.


Now consider this piece:

```
import core.stdc.stdio;

extern(C) void main() {
 putchar('a');
}
```

Oops, `Error 42: Symbol Undefined 
__D4core4stdc5stdio7putcharFNbNiNeiZi`! To my surprise, `putchar` is 
extern'd as D in druntime/src/core/stdc/stdio.d, and I find that _really 
silly_.


Which means `putchar`, during linking, is affected for linking every 
single C runtime out there, and the only reason I can think of is to 
easily integrate it with D in general, which in my opinion, is not 
necessarily needed since the D people (not meant as an insult) promotes 
betterC as a stand-alone option.


On Windows, stdin, stdout, and stderr are affected when using -m32mscoff 
and -m64 (and obviously, LDC) because under CRuntime_Microsoft, std* are 
defined as `shared`.


I'm aware that an easy solution would be defining a version (D_betterC) 
section.


Will I do a Pull Request? Unfortunately no, I fear I'll abandon mid-way 
through. It's easier to advise the forums and let an actual professional 
integrate the fix.


If you have other suggestions, I'm all ears.


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


--
/Jacob Carlborg


Re: DConf 2018 Munich Registration is Open!

2018-04-29 Thread Bastiaan Veelo via Digitalmars-d-announce

On Monday, 19 March 2018 at 13:34:36 UTC, Mike Parker wrote:

...

Visit dconf.org to see the programme[1] and register[2], then 
head over to the D Blog[3] for the latest post on DConf.


See you in Munich May 2-5!


[1] http://dconf.org/2018/schedule/index.html
[2] http://dconf.org/2018/registration.html
[3] 
http://dlang.org/blog/2018/03/19/dconf-2018-programme-open-registration/


I’m looking forward to following DConf this week remotely, the 
next best thing to being there in person! I wish all presenters 
good luck and that the conference be fruitful to it’s attendees 
and dlang as a whole.


My best greetings to all that I met last year and I hope to see 
you at a future conference!


Bastiaan.


Re: core.stdc and betterC

2018-04-29 Thread rikki cattermole via Digitalmars-d

On 30/04/2018 3:05 AM, dd86k wrote:

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.


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.


It also isn't specific to core.stdc.*. Just your usage of it (-I'ing only).


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 rikki cattermole via Digitalmars-d

On 30/04/2018 2:42 AM, dd886k wrote:

Hello!

This is my first time posting, so do feel free to correct me and this post.

I started writing in D around Q2 2017 and recently been re-writing some 
of my projects as betterC (entirely!).


I noticed something weird. It started with DMD 2.074.0 and it's still an 
issue for me in DMD 2.079.1 (and any other compiler really).


Consider this piece:

```
import core.stdc.stdio;

extern(C) void main() {
 printf("a");
}
```

It compiles and runs absolutely wonderful (OMF, MSCOFF, ELF, etc.). No 
issues.


Now consider this piece:

```
import core.stdc.stdio;

extern(C) void main() {
 putchar('a');
}
```

Oops, `Error 42: Symbol Undefined 
__D4core4stdc5stdio7putcharFNbNiNeiZi`! To my surprise, `putchar` is 
extern'd as D in druntime/src/core/stdc/stdio.d, and I find that _really 
silly_.


Which means `putchar`, during linking, is affected for linking every 
single C runtime out there, and the only reason I can think of is to 
easily integrate it with D in general, which in my opinion, is not 
necessarily needed since the D people (not meant as an insult) promotes 
betterC as a stand-alone option.


On Windows, stdin, stdout, and stderr are affected when using -m32mscoff 
and -m64 (and obviously, LDC) because under CRuntime_Microsoft, std* are 
defined as `shared`.


I'm aware that an easy solution would be defining a version (D_betterC) 
section.


Will I do a Pull Request? Unfortunately no, I fear I'll abandon mid-way 
through. It's easier to advise the forums and let an actual professional 
integrate the fix.


If you have other suggestions, I'm all ears.


Welcome.

I just checked, extern(D) isn't at fault. You actually do want name 
mangling for wrapper functions like that.


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.


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


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.


Re: Tilix 1.7.9 Released

2018-04-29 Thread Dgame via Digitalmars-d-announce

On Sunday, 29 April 2018 at 14:01:10 UTC, Gerald wrote:
A new version of tilix has been released. For those not 
familiar with it, Tilix is a terminal emulator for Linux 
written in D using GTK. The list of changes is available here:


https://gnunn1.github.io/tilix-web/2018/04/28/release-1-7-9

As always, I'm always looking for people who are interested in 
contributing, PRs welcome.


Finally a big thank you to Mike Wey who has continued to work 
on and evolve GtkD. Working on libraries is often behind the 
scenes work that doesn't get the appreciation it deserves.


I was struck by a recent reddit post on the gnome shell memory 
leak which involved C and javascript, it mentioned how 
difficult it is to merge two different memory models. Mike has 
managed this with aplomb in terms of integrating the Gtk 
reference counting into D's GC. So thanks Mike, your efforts 
are much appreciated!


Since I'm on Windows I sadly can't use it, but I suggested it to 
my colleagues - which are using Ubuntu - half a year ago and they 
use it since then and still love it. So keep up the good work! :)


core.stdc and betterC

2018-04-29 Thread dd886k via Digitalmars-d

Hello!

This is my first time posting, so do feel free to correct me and 
this post.


I started writing in D around Q2 2017 and recently been 
re-writing some of my projects as betterC (entirely!).


I noticed something weird. It started with DMD 2.074.0 and it's 
still an issue for me in DMD 2.079.1 (and any other compiler 
really).


Consider this piece:

```
import core.stdc.stdio;

extern(C) void main() {
printf("a");
}
```

It compiles and runs absolutely wonderful (OMF, MSCOFF, ELF, 
etc.). No issues.


Now consider this piece:

```
import core.stdc.stdio;

extern(C) void main() {
putchar('a');
}
```

Oops, `Error 42: Symbol Undefined 
__D4core4stdc5stdio7putcharFNbNiNeiZi`! To my surprise, `putchar` 
is extern'd as D in druntime/src/core/stdc/stdio.d, and I find 
that _really silly_.


Which means `putchar`, during linking, is affected for linking 
every single C runtime out there, and the only reason I can think 
of is to easily integrate it with D in general, which in my 
opinion, is not necessarily needed since the D people (not meant 
as an insult) promotes betterC as a stand-alone option.


On Windows, stdin, stdout, and stderr are affected when using 
-m32mscoff and -m64 (and obviously, LDC) because under 
CRuntime_Microsoft, std* are defined as `shared`.


I'm aware that an easy solution would be defining a version 
(D_betterC) section.


Will I do a Pull Request? Unfortunately no, I fear I'll abandon 
mid-way through. It's easier to advise the forums and let an 
actual professional integrate the fix.


If you have other suggestions, I'm all ears.


Re: Whats wrong with the forum.dlang.org???

2018-04-29 Thread Vladimir Panteleev via Digitalmars-d
On Sunday, 29 April 2018 at 13:14:35 UTC, Steven Schveighoffer 
wrote:
In the newsgroups, there was a post in March on "ost to pst 
convertes", which looks like it could have been flagged with 
spam (it no longer appears on the forum), with two "ad-like" 
responses, and a third is from notna, which looks more like a 
real response, even though it just has a URL in it. His history 
of posts that I've seen have been legitimate.


Yes, that's exactly it. It was a post in an off-topic thread with 
nothing but a link to a commercial product, so in fact it is 
indistinguishable from spam. It is also very similar to the 
common setup where someone posts an off-topic but otherwise 
unspammy question (generally seeking advice or a product 
recommendation), and is followed-up by actual spam. It was 
flagged by someone too, which is how it got deleted. All facts 
considered it's a bit hard to call this a false positive :)


notna: You are now unbanned, but I suggest to avoid doing this 
again.




[Issue 18810] root/ctfloat depends upon backend

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18810

Richard Cattermole  changed:

   What|Removed |Added

 CC||alphaglosi...@gmail.com

--


[Issue 18811] root/array.d leaks

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18811

Richard Cattermole  changed:

   What|Removed |Added

 CC||alphaglosi...@gmail.com

--


Tilix 1.7.9 Released

2018-04-29 Thread Gerald via Digitalmars-d-announce
A new version of tilix has been released. For those not familiar 
with it, Tilix is a terminal emulator for Linux written in D 
using GTK. The list of changes is available here:


https://gnunn1.github.io/tilix-web/2018/04/28/release-1-7-9

As always, I'm always looking for people who are interested in 
contributing, PRs welcome.


Finally a big thank you to Mike Wey who has continued to work on 
and evolve GtkD. Working on libraries is often behind the scenes 
work that doesn't get the appreciation it deserves.


I was struck by a recent reddit post on the gnome shell memory 
leak which involved C and javascript, it mentioned how difficult 
it is to merge two different memory models. Mike has managed this 
with aplomb in terms of integrating the Gtk reference counting 
into D's GC. So thanks Mike, your efforts are much appreciated!


Re: Favorite GUI library?

2018-04-29 Thread Jacob Carlborg via Digitalmars-d

On 2018-04-28 19:39, User wrote:

Dwt is nice, but no glade like gui editor.  when using dwt, I build gui 
manually.


You might be able to use WindowBuilder [1] and port the Java code to D.

[1] https://www.eclipse.org/windowbuilder/

--
/Jacob Carlborg


Re: What stops DMD from cross-compiling?

2018-04-29 Thread Jacob Carlborg via Digitalmars-d

On 2018-04-28 12:02, Vladimir Panteleev wrote:

Probably the closest thing to cross-platform building would be through 
LDC, as LLVM already includes everything for C cross compilation.


Except for a C standard library.

--
/Jacob Carlborg


Re: What stops DMD from cross-compiling?

2018-04-29 Thread Jacob Carlborg via Digitalmars-d

On 2018-04-28 10:49, Rel wrote:


Something like memcpy and similar stuff is easy to implement.
If we are talking about Linux stuff like open, malloc and etc
can be implemented either by using syscalls or by generating
the binding to the libc.so of some minimal version that we
decide to support (like Pascal compiler do). If we are talking
about Windows all of the needed functions can be reimplemented
using API provided by kernel32.dll and friends.


For macOS I'm thinking functions that are implemented in the dynamic 
loader [1] or other platform specific functions [2]. For macOS the 
thread local implementation is in the dynamic loader. It will setup TLS 
variables before C main function is called. That would need to be 
reimplemented.



Downloading some SDK's from dropbox accounts is the thing I'd
like to avoid, 


If you have access to a machine running the target system you can 
copy/extract the SDK yourself. If you don't have there's Travis CI which 
has support for macOS and AppVeyor which supports Windows which you can 
copy the SDK from.


When it comes to the SDK for macOS we might be able to ship our own SDK. 
Most of the libraries are dynamic libraries. The SDK doesn't actually 
contain any real libraries, only YAML files containing some metadata and 
the symbols the library defines. We could generate those YAML files 
ourselves based on the real libraries.


I don't know what the SDK EULA says about this. But since we created the 
files I think we should be able to distribute them.



I'd like the Dlang compiler to be a self-contained
toolchain.

That would be ideal yes.

[1] 
https://github.com/dlang/druntime/blob/master/src/core/sys/darwin/mach/dyld.d


[2] 
https://github.com/dlang/druntime/blob/master/src/core/sys/darwin/mach/getsect.d


--
/Jacob Carlborg


[Issue 18811] New: root/array.d leaks

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18811

  Issue ID: 18811
   Summary: root/array.d leaks
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: minor
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: alphaglosi...@gmail.com

With -version=GC root/array.d will leak memory.
But only when dim is 1.

This is because it is putting it into smallarray, instead of allocating memory.

It can be verified by setting SMALLARRAYCAP to 0 and removing the if statement
in the destructor.

During my testing with dmd as a library it will result in ~0.5mb leakage. The
test cases were small, but in much larger cases this could be quite serious for
reusability.

This could be a by product of other issues, I do not know.

--


Re: Whats wrong with the forum.dlang.org???

2018-04-29 Thread Steven Schveighoffer via Digitalmars-d

On 4/29/18 8:58 AM, Vladimir Panteleev wrote:

On Sunday, 29 April 2018 at 10:45:56 UTC, notna wrote:

Hi folks.

I'm wondering... is no one else using it or did I miss that someone 
already raised the same question...


Since days I get a

"""
403(Forbidden)

You have tried to access a restricted or unavailable resource, or 
attempted to circumvent server security.


Error details:

You're banned!

"""


This message usually means that you're visiting the site from an IP that 
was previously used to post spam. This can happen if your ISP allocates 
dynamic IPs (and another ISP customer's machine sent spam), you are 
using a proxy or VPN (which are frequently used by spammers to post 
spam), or your machine or a machine on your network was infected by 
malware and used to post spam.


If you think your machines are clean and not being used to send spam, 
send me your IP address by email to no...@thecybershadow.net and I'll 
get it removed.




In the newsgroups, there was a post in March on "ost to pst convertes", 
which looks like it could have been flagged with spam (it no longer 
appears on the forum), with two "ad-like" responses, and a third is from 
notna, which looks more like a real response, even though it just has a 
URL in it. His history of posts that I've seen have been legitimate.


-Steve


Re: Whats wrong with the forum.dlang.org???

2018-04-29 Thread Vladimir Panteleev via Digitalmars-d

On Sunday, 29 April 2018 at 10:45:56 UTC, notna wrote:

Hi folks.

I'm wondering... is no one else using it or did I miss that 
someone already raised the same question...


Since days I get a

"""
403(Forbidden)

You have tried to access a restricted or unavailable resource, 
or attempted to circumvent server security.


Error details:

You're banned!

"""


This message usually means that you're visiting the site from an 
IP that was previously used to post spam. This can happen if your 
ISP allocates dynamic IPs (and another ISP customer's machine 
sent spam), you are using a proxy or VPN (which are frequently 
used by spammers to post spam), or your machine or a machine on 
your network was infected by malware and used to post spam.


If you think your machines are clean and not being used to send 
spam, send me your IP address by email to 
no...@thecybershadow.net and I'll get it removed.




[Issue 18810] New: root/ctfloat depends upon backend

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18810

  Issue ID: 18810
   Summary: root/ctfloat depends upon backend
   Product: D
   Version: D2
  Hardware: x86
OS: Windows
Status: NEW
  Severity: regression
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: alphaglosi...@gmail.com

For Windows using -m64 or -m32mscoff root/ctfloat depends upon the backend for
the symbols ld_sprint and strtold_dm.

They are defined in el.c and strtold.c.

This is a blocker for dmd as a library depending upon how it is used.

LDC[0] has outright removed both symbols.

[0]
https://github.com/ldc-developers/ldc/blob/a9c76cff3af12aca3d5335633f14fd51a7416682/dmd/root/ctfloat.d#L38

--


Whats wrong with the forum.dlang.org???

2018-04-29 Thread notna via Digitalmars-d

Hi folks.

I'm wondering... is no one else using it or did I miss that someone 
already raised the same question...


Since days I get a

"""
403(Forbidden)

You have tried to access a restricted or unavailable resource, or 
attempted to circumvent server security.


Error details:

You're banned!

"""

from https://forum.dlang.org/. Please fix it either or remove the site 
and all references (like in "learn") to it...


Thanks


[Issue 18809] New: Improve error message on nonexistent property

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18809

  Issue ID: 18809
   Summary: Improve error message on nonexistent property
   Product: D
   Version: D2
  Hardware: All
OS: All
Status: NEW
  Severity: enhancement
  Priority: P1
 Component: dmd
  Assignee: nob...@puremagic.com
  Reporter: dl...@ryanjframe.com

The following code:

---
struct SomeStruct {}

void main() {
auto s = SomeStruct();
s.nonexistent = "hello";
}
---

yields the error message:

"source\app.d(5,6): Error: no property nonexistent for type SomeStruct"

Here, that's not a problem. But if SomeStruct was defined in another module,
especially in a large or unfamiliar project, it would be helpful to have the
fully qualified name to quickly identify the location of the type's definition:

"source\app.d(5,6): Error: no property nonexistent for type app.SomeStruct"

--


[Issue 18808] New: dmd not found after installation using script

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18808

  Issue ID: 18808
   Summary: dmd not found after installation using script
   Product: D
   Version: D2
  Hardware: x86_64
OS: Linux
Status: NEW
  Severity: critical
  Priority: P1
 Component: installer
  Assignee: nob...@puremagic.com
  Reporter: bachm...@yahoo.com

If I install using the script

curl -fsS https://dlang.org/install.sh | bash -s dmd

It gives the message

Run `source ~/dlang/dmd-2.079.1/activate` in your shell to use dmd-2.079.1.
This will setup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1.

That works until you close the current terminal. As soon as you use a new
terminal, you get

Command 'dmd' not found

On Ubuntu 18.04. I put the severity at critical because the installation
process needs to work.

--


[Issue 18807] New: RefRange behaves very differently for Input Ranges and Forward Ranges

2018-04-29 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18807

  Issue ID: 18807
   Summary: RefRange behaves very differently for Input Ranges and
Forward Ranges
   Product: D
   Version: D2
  Hardware: All
   URL: http://dlang.org/
OS: All
Status: NEW
  Severity: major
  Priority: P3
 Component: phobos
  Assignee: nob...@puremagic.com
  Reporter: e...@weka.io

Example program:

import std.range: refRange, iota;

struct R1 {
auto r = iota(3);
alias r this;
}
void works() {
R1 r1;
foreach(x; refRange()) {}
assert(r1.empty);
}

struct R2 {
auto r = iota(3);
alias r this;
@property auto save() { return this; }
}
void explodes() {
R2 r2;
import std.range;
foreach(x; refRange()) {}
assert(r2.empty);   // <-- BOOM
}

works() is fine.
explodes() fails on the assertion.

The only difference is that R2 defines save().

What happens is that the foreach calls opSlice (if it exists), which calls
save. opSlice exists iff save exists.

Upgrading an existing input range to a forward range invisibly breaks any code
that used foreach on a refRange of that range.

--


Re: E-mail attachment with unwanted characters

2018-04-29 Thread Vino.B via Digitalmars-d-learn

On Saturday, 28 April 2018 at 16:37:26 UTC, Vino.B wrote:

On Friday, 27 April 2018 at 18:20:46 UTC, Adam D. Ruppe wrote:

[...]


Hi Adam,

 Thank you very much, after removing the dot the unwanted 
characters disappeared, The earlier program (as function) is 
working as expected without any issue, but if I change the 
program from function to Classes, then the programing is 
executing without any errors, able to get the attachment wihout 
any unwanted characters, but not able to get the body text, 
tries passing the body text as Array!sting and normal string, 
even then the body message is not appearing when I receive the 
mails.


[...]


Hi Adam,

 Thank you very much, was able to resolve the issue.

From,
Vino.B