Dynamically calling shared objects from statically build executable allowed

2020-02-09 Thread Andre Pany via Digitalmars-d-learn

Hi,

while dynamically calling a shared object from a statically
build executable on linux, both LDC and DMD fails with a
non-zero code 139.

In my productive system the SO is written in C++,
for reproduction I wrote a sample SO in D.

You can find the example here
https://github.com/ldc-developers/ldc/issues/3310


Is this a bug with LDC and DMD, or is it not allowed
to dynamically call a SO from a statically build executable on 
linux?


Background: The SO file I get from third party, while the 
executable
I develop. I need to run the executable on a distroless docker 
image (SCRATCH),
therefore I try to reduce system dependencies on my side by 
building a static executable.


PS. DMD even fails without the static switch with:
Aborting from src/rt/sections_elf_shared.d(480) DSO being 
unregistered isn't current last one.


Kind regards
André




Re: total newbie + IDE

2020-02-09 Thread Mike Parker via Digitalmars-d-learn

On Sunday, 9 February 2020 at 22:10:57 UTC, solnce wrote:

Personally I feel this is more about lack of the vision, as 
Alexandrescu once said. Now it feels like D is mostly the 
compiler, but I think, that having one big mega project (like 
IDE+RAD) could give a new breath and significance to D language.


There's absolutely no need for an IDE to be written in D 
(particularly one that supports RAD -- what would that use? 
GtkD?). For one thing, it's a massive project for which the D 
team does not have the resources to achieve. For another, there 
are already several popular IDEs and text editors for which 
plugins have been developed by community members. It would be a 
waste of time and energy for the D team to work on an IDE project.


If someone is inspired to write an IDE in D (and some have been 
in the past), nothing is stopping them.


Re: How to compile with GtkD

2020-02-09 Thread Mike Wey via Digitalmars-d-learn

On 09-02-2020 12:52, mark wrote:


I am trying to build a simple "hello world" app (from the gtkDcoding 
blog) in $HOME/app/d/gtktest (which is a dub init created directory) and 
have this dub.sdl:


name "gtktest"
description "Gtk Test"
authors "Mark"
targetType "executable"
dependency "gtk-d:gtkd" version=">=3.9.0"
importPaths "$HOME/opt/GtkD3"
libs "libgtkd-3"


Libraries should be passed to dub / ld without the lib prefix, so that 
last line would become: libs "gtkd-3"


Since dub will build a copy of the libraries listed as dependencies, you 
can either remove the dependency line, or the importPaths and libs 
lines. Since now you are linking against both the library build by dub 
and the one on your system.


--
Mike Wey


Re: total newbie + IDE

2020-02-09 Thread Laurent Tréguier via Digitalmars-d-learn

On Sunday, 9 February 2020 at 22:10:57 UTC, solnce wrote:
No, I understand that and agree - VSCode is impressive and I'll 
try it, but what is wrong with idea to have a dedicated IDE? At 
least one. C/C++ has tons of these and many of these are being 
actively developed, so why D cannot have? Especially when it is 
aiming to replace C/C++. Argument that VSCode is pretty much 
enough for most task it is ok, but is not very valid. The same 
applies to D itself - why to make a new language then when 
there is C++ around and there is a tons of IDE's for it.


Personally I feel this is more about lack of the vision, as 
Alexandrescu once said. Now it feels like D is mostly the 
compiler, but I think, that having one big mega project (like 
IDE+RAD) could give a new breath and significance to D language.


Making an entire IDE would be a lot of work. Making plugins for 
existing editors is already time consuming, and is less work than 
building a complete solution.
Given how powerful regular editors can be, whether it's VSCode, 
Vim or Emacs, plugins make for a good compromise bewteen the time 
spent making the plugin, and the result you get.


Re: total newbie + IDE

2020-02-09 Thread solnce via Digitalmars-d-learn

On Sunday, 9 February 2020 at 18:17:13 UTC, JN wrote:

On Sunday, 9 February 2020 at 13:22:56 UTC, solnce wrote:
I really enjoy Pascal having Lazarus. Although it is not 
perfected, it provides very good start for beginners - native 
IDE, RAD, easy to setup and adjust, integrated debugger. All 
that beginners need to have for good start at no time cost. It 
is just language doesn't evolve itself.




There isn't anything comparable to RAD for D. There was one 
being developed in the days od D1 for the DFL UI library - 
http://www.dprogramming.com/entice.php , but it's been long 
dead.


You can use GLADE to design an interface and then load it in a 
GtkD.


And it is after 13 years of in active development and being 
successor (as it claims so) to C++. ADA has it, Eiffel has it, 
FPC, Gambino many niche and small languages have it, why D, 
which has much wider application,  cannot have it? I think 
that is natural further evolution of any programming language.


I think the text editor/IDE landscape changed a little in last 
decade or so. Editors such as Sublime Text or Ultraedit lost 
their popularity, so did small language specific IDEs such as 
Dev-C++ or Code::blocks. Most of users of these IDEs migrated 
to the big projects like VSCode, Visual Studio or IntelliJ. 
Also, the introduction of language servers allows working on 
IDE support, without being bound to a specific IDE.


Editors/IDEs such as VSCode have a massive ecosystem. Why not 
take advantage of it, rather than start from scratch.


No, I understand that and agree - VSCode is impressive and I'll 
try it, but what is wrong with idea to have a dedicated IDE? At 
least one. C/C++ has tons of these and many of these are being 
actively developed, so why D cannot have? Especially when it is 
aiming to replace C/C++. Argument that VSCode is pretty much 
enough for most task it is ok, but is not very valid. The same 
applies to D itself - why to make a new language then when there 
is C++ around and there is a tons of IDE's for it.


Personally I feel this is more about lack of the vision, as 
Alexandrescu once said. Now it feels like D is mostly the 
compiler, but I think, that having one big mega project (like 
IDE+RAD) could give a new breath and significance to D language.





Re: total newbie + IDE

2020-02-09 Thread JN via Digitalmars-d-learn

On Sunday, 9 February 2020 at 13:22:56 UTC, solnce wrote:
I really enjoy Pascal having Lazarus. Although it is not 
perfected, it provides very good start for beginners - native 
IDE, RAD, easy to setup and adjust, integrated debugger. All 
that beginners need to have for good start at no time cost. It 
is just language doesn't evolve itself.




There isn't anything comparable to RAD for D. There was one being 
developed in the days od D1 for the DFL UI library - 
http://www.dprogramming.com/entice.php , but it's been long dead.


You can use GLADE to design an interface and then load it in a 
GtkD.


And it is after 13 years of in active development and being 
successor (as it claims so) to C++. ADA has it, Eiffel has it, 
FPC, Gambino many niche and small languages have it, why D, 
which has much wider application,  cannot have it? I think that 
is natural further evolution of any programming language.


I think the text editor/IDE landscape changed a little in last 
decade or so. Editors such as Sublime Text or Ultraedit lost 
their popularity, so did small language specific IDEs such as 
Dev-C++ or Code::blocks. Most of users of these IDEs migrated to 
the big projects like VSCode, Visual Studio or IntelliJ. Also, 
the introduction of language servers allows working on IDE 
support, without being bound to a specific IDE.


Editors/IDEs such as VSCode have a massive ecosystem. Why not 
take advantage of it, rather than start from scratch.


Re: total newbie + IDE

2020-02-09 Thread solnce via Digitalmars-d-learn

On Sunday, 9 February 2020 at 14:32:38 UTC, Martin Brezel wrote:

On Sunday, 9 February 2020 at 13:22:56 UTC, solnce wrote:

I was expecting D lang to have something similar,if not an 
RAD, then native IDE with all that basic functionality support.


VisualStudioCode seems to be what you are looking for - except 
I do not fully understand what you mean by "native".


By saying Native I mean, written in D and by D team or be closely 
associated with D. In other words, to be a part of broader D 
project.


Everything what I could find and what works "out of the box" has 
nothing to do with D and is made work trough plugins mostly. That 
is disappointing.


S


Re: total newbie + IDE

2020-02-09 Thread Martin Brezel via Digitalmars-d-learn

On Sunday, 9 February 2020 at 13:22:56 UTC, solnce wrote:

I was expecting D lang to have something similar,if not an RAD, 
then native IDE with all that basic functionality support.


VisualStudioCode seems to be what you are looking for - except I 
do not fully understand what you mean by "native".


Re: GtkD on Windows: notes + question

2020-02-09 Thread Daniel Kozak via Digitalmars-d-learn
"lflags-windows": ["/SUBSYSTEM:WINDOWS", "/ENTRY:mainCRTStartup"],

On Sun, Feb 9, 2020 at 2:30 PM mark via Digitalmars-d-learn
 wrote:
>
> I found a much easier way to get GtkD working on windows than
> that described in
> https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html
>
> 1. I downloaded and installed the Gtk3 runtime (the link is on
> https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html)
>
> 2. I downloaded and unzipped the GtkD3 zip to C:\bin\GtkD3
>
> 3. Since I'd already installed LDC I just had to run:
>
>  dub add-path C:\bin\GtkD3
>
> Now I'm able to build and run on windows using dub. And again, I
> get static builds so have deployable .exes.
>
> However, when I double-click a GtkD .exe it pops up a console
> window, then the GUI window, and the console window stays until I
> close the GUI.
>
> Is there a way to avoid the console Window, at least for release
> builds?
>


Re: GtkD on Windows: notes + question

2020-02-09 Thread JN via Digitalmars-d-learn

On Sunday, 9 February 2020 at 13:28:59 UTC, mark wrote:
I found a much easier way to get GtkD working on windows than 
that described in 
https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html


1. I downloaded and installed the Gtk3 runtime (the link is on 
https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html)


2. I downloaded and unzipped the GtkD3 zip to C:\bin\GtkD3

3. Since I'd already installed LDC I just had to run:

dub add-path C:\bin\GtkD3

Now I'm able to build and run on windows using dub. And again, 
I get static builds so have deployable .exes.


However, when I double-click a GtkD .exe it pops up a console 
window, then the GUI window, and the console window stays until 
I close the GUI.


Is there a way to avoid the console Window, at least for 
release builds?


https://forum.dlang.org/thread/xkvdpdsfzevanucrg...@forum.dlang.org


GtkD on Windows: notes + question

2020-02-09 Thread mark via Digitalmars-d-learn
I found a much easier way to get GtkD working on windows than 
that described in 
https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html


1. I downloaded and installed the Gtk3 runtime (the link is on 
https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html)


2. I downloaded and unzipped the GtkD3 zip to C:\bin\GtkD3

3. Since I'd already installed LDC I just had to run:

dub add-path C:\bin\GtkD3

Now I'm able to build and run on windows using dub. And again, I 
get static builds so have deployable .exes.


However, when I double-click a GtkD .exe it pops up a console 
window, then the GUI window, and the console window stays until I 
close the GUI.


Is there a way to avoid the console Window, at least for release 
builds?




Re: total newbie + IDE

2020-02-09 Thread solnce via Digitalmars-d-learn

On Saturday, 8 February 2020 at 09:26:41 UTC, Marcone wrote:
You don't need an IDE for run Dlang. I Use "Sublime Text". Very 
good for Dlang.


I am sorry if my questions appear stupid, but I am very curious.

I really enjoy Pascal having Lazarus. Although it is not 
perfected, it provides very good start for beginners - native 
IDE, RAD, easy to setup and adjust, integrated debugger. All that 
beginners need to have for good start at no time cost. It is just 
language doesn't evolve itself.


I was expecting D lang to have something similar,if not an RAD, 
then native IDE with all that basic functionality support. Now it 
appears that it is much more complicated - existing native IDE's 
are (almost) not being maintained, doesn't compile or in similar 
trouble. And it is after 13 years of in active development and 
being successor (as it claims so) to C++. ADA has it, Eiffel has 
it, FPC, Gambino many niche and small languages have it, why D, 
which has much wider application,  cannot have it? I think that 
is natural further evolution of any programming language.


You may think that is not important, but I think it is. Having 
working IDE within few mouse clicks  would greatly contribute to 
interest in language, attract more users of various levels and 
skills, help adopt language in universities.


I didn't read trough entire forum, but I believe, there should 
have been a discussion on that. So what are the opinions?


Thanks
s


Re: How to compile with GtkD [solved]

2020-02-09 Thread mark via Digitalmars-d-learn
Turns out I didn't need to add lines to dub.sdl at all. So my 
dub.sdl is now just:


name "gtktest"
description "Gtk Test"
authors "Mark"
targetType "executable"
dependency "gtk-d:gtkd" version=">=3.9.0"

The solution was to do this:

$ dub add-path ~/opt/GtkD3/

After that it does static builds, which is great, gives me 
self-contained executables.


Re: How to compile with GtkD

2020-02-09 Thread mark via Digitalmars-d-learn

On Sunday, 9 February 2020 at 12:03:23 UTC, Ron Tarrant wrote:

On Sunday, 9 February 2020 at 11:52:19 UTC, mark wrote:


right now I want to start on Linux and I'm stuck.

Maybe this will help...

https://gtkdcoding.com/2019/03/31/x0002-gtkd-in-a-linux-environment.html


Unfortunately it didn't because I have locally installed LDC and 
GtkD.


Generally, for development I prefer to install (and on Linux 
build) languages and libs myself rather than using system 
versions.


What I really need is to know how to change my dub.sdl to send 
the right arguments to ldc2.


Re: Getting the initial value of a class field in compile time.

2020-02-09 Thread realhet via Digitalmars-d-learn
On Sunday, 9 February 2020 at 02:25:56 UTC, Steven Schveighoffer 
wrote:

On 2/8/20 7:39 PM, realhet wrote:

On Sunday, 9 February 2020 at 00:15:47 UTC, Drug wrote:

On Saturday, 8 February 2020 at 23:37:56 UTC, realhet wrote:


Yea, I exactly ran into that "init" problem, I will avoid that, 
thx!


Re: Getting the initial value of a class field in compile time.

2020-02-09 Thread realhet via Digitalmars-d-learn

On Sunday, 9 February 2020 at 01:19:55 UTC, Paul Backus wrote:

On Sunday, 9 February 2020 at 00:57:05 UTC, realhet wrote:

On Sunday, 9 February 2020 at 00:41:12 UTC, realhet wrote:

On Sunday, 9 February 2020 at 00:27:21 UTC, Adam D. Ruppe

enum initValue = (new typeof(this)).tupleof[i];


Wow, thx! Accessing by index instead of name. Really powerful!



Re: How to compile with GtkD

2020-02-09 Thread Ron Tarrant via Digitalmars-d-learn

On Sunday, 9 February 2020 at 11:52:19 UTC, mark wrote:


right now I want to start on Linux and I'm stuck.

Maybe this will help...

https://gtkdcoding.com/2019/03/31/x0002-gtkd-in-a-linux-environment.html


How to compile with GtkD

2020-02-09 Thread mark via Digitalmars-d-learn
According to the GtkD web site https://gtkd.org/ this GUI library 
is cross-platform, so hopefully just what I need.


The introductory blog 
https://gtkdcoding.com/2019/01/11/-introduction-to-gtkDcoding.html explains how to install and get started with GtkD on Windows (which I plan to use later on), but right now I want to start on Linux and I'm stuck.


I have LDC in $HOME/opt/ldc2-1.19.0-linux-x86_64 with the bin/ 
dir in my path, and GtkD 3.9.0 in $HOME/opt/GtkD3


I am trying to build a simple "hello world" app (from the 
gtkDcoding blog) in $HOME/app/d/gtktest (which is a dub init 
created directory) and have this dub.sdl:


name "gtktest"
description "Gtk Test"
authors "Mark"
targetType "executable"
dependency "gtk-d:gtkd" version=">=3.9.0"
importPaths "$HOME/opt/GtkD3"
libs "libgtkd-3"

The error I get is:

$ dub
Performing "debug" build using /home/mark/opt/bin/ldc2 for x86_64.
gtk-d:gtkd 3.9.0: target for configuration "library" is up to 
date.

gtktest ~master: building configuration "application"...
Linking...
/usr/bin/ld.gold: error: cannot find -llibgtkd-3
collect2: error: ld returned 1 exit status
Error: /usr/bin/cc failed with status: 1
/home/mark/opt/bin/ldc2 failed with exit code 1.

$ cd ~/opt/GtkD3
$ ls *.a
libgstreamerd-3.a
libgtkd-3.a
libgtkdsv-3.a
libpeasd-3.a
libvted-3.a

I also tried specifying libs as "gtkd-3" and had the same problem.

I can run $HOME/opt/GtkD3/TestWindow and it works fine. And I can 
also build it in $HOME/opt/GtkD3/demos/gtkD/TestWindow. However, 
it uses a dub.json with "dependencies": { "gtk-d:gtkd": {"path": 
"../../../" }, } and I don't know what the dub.sdl equivalent of 
this is. (I prefer .sdl to .json.)




Re: books for learning D

2020-02-09 Thread Marcone via Digitalmars-d-learn

Programming in D - Tutorial and Reference 1st Edition
Free PDF Book.
Download: http://ddili.org/ders/d.en/index.html