local dub dependencies - relative paths, copyFiles, etc

2019-05-03 Thread DanielG via Digitalmars-d-learn

First issue:

I have a dub project (executable) that's dependent on another 
local dub project (library). It's cross-platform but I'm having 
this problem in Windows at the moment...


My D library links against a win32 DLL/LIB, and I'm specifying 
that in the dub.sdl for the library, relative to the library root 
/ dub.sdl location. Sensible, no?


However, when building the executable - in another location, 
referring to the library via a relative local path, I'm forced to 
modify the location of the win32 .LIB specification to be 
relative to my executable dub file, *not* the library.


So it seems like dub forgets to calculate the path relative to 
the library, where the path is specified in the first place.


Is this expected behavior? Is there some kind of special relative 
root I need to use in the library's dub.sdl?


Second issue (perhaps related?)

I'm specifying a copyFiles in the library project to gather up 
all the requisite .DLLs, which I would hope would be copied to my 
executable's target path ... but that doesn't appear to be 
working. The "copying files..." step shows up in the dub output, 
but no matter how I specify it (relative to library or executable 
or just gibberish), it appears nothing is happening during that 
step.


Re: Any full feature xml library available?

2019-05-03 Thread Domain via Digitalmars-d-learn

On Friday, 3 May 2019 at 21:07:29 UTC, H. S. Teoh wrote:
On Fri, May 03, 2019 at 09:56:56PM +0100, Russel Winder via 
Digitalmars-d-learn wrote:
On Thu, 2019-05-02 at 09:28 -0700, H. S. Teoh via 
Digitalmars-d-learn wrote:

> On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via
> Digitalmars-d-learn wrote:
> [...]
> > [...]
> [...]
> 
> No particular reason, except nobody has taken up the task 
> yet. Would you?


If I were interested in XML processing yes I would. However, 
just at the moment I am doing things with MPEG-TS and 
gstreamer-rs. I may investigate the analogue for GstreamerD.


On the other hand there are enough people moaning about 
std.xml and the general lack of quality, high performance D 
support for XML that there is clearly a lot of people who 
should be interested in creating a D binding to libxml2.

[...]

The problem is that while there is no shortage of complaints 
about XML support in D, there is a great dearth of people 
actually willing to *do* something about it.


At least Jonathan wrote dxml, which arguably would meet the 
need in most cases.  So there's that.  But if somebody wants 
entity references and other similar things, the only recourse 
would appear to be to wrap libxml2.  Given D's aptitude at 
interfacing with C, this should be much simpler than writing 
dxml.  It just needs someone to sit down and *do* it.



T


I am trying to port libxml++ to D.
I use dstep to generate the binding to libxml2, and then porting 
c++ to D.
But I don't have much time, and there are some failures with 
dstep. I don't have a computer at home, so I must use termux to 
coding. I hope someone can continue to maintaining the android 
port of ldc.


Re: Any full feature xml library available?

2019-05-03 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, May 03, 2019 at 09:56:56PM +0100, Russel Winder via Digitalmars-d-learn 
wrote:
> On Thu, 2019-05-02 at 09:28 -0700, H. S. Teoh via Digitalmars-d-learn
> wrote:
> > On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via
> > Digitalmars-d-learn wrote:
> > [...]
> > > There are situations where you create a binding in preference to
> > > writing something from scratch. cf. gtk, gstreamer, etc. so why
> > > not libxml2?
> > [...]
> > 
> > No particular reason, except nobody has taken up the task yet. Would
> > you?
> 
> If I were interested in XML processing yes I would. However, just at
> the moment I am doing things with MPEG-TS and gstreamer-rs. I may
> investigate the analogue for GstreamerD.
> 
> On the other hand there are enough people moaning about std.xml and
> the general lack of quality, high performance D support for XML that
> there is clearly a lot of people who should be interested in creating
> a D binding to libxml2.
[...]

The problem is that while there is no shortage of complaints about XML
support in D, there is a great dearth of people actually willing to *do*
something about it.

At least Jonathan wrote dxml, which arguably would meet the need in most
cases.  So there's that.  But if somebody wants entity references and
other similar things, the only recourse would appear to be to wrap
libxml2.  Given D's aptitude at interfacing with C, this should be much
simpler than writing dxml.  It just needs someone to sit down and *do*
it.


T

-- 
Questions are the beginning of intelligence, but the fear of God is the 
beginning of wisdom.


Re: Any full feature xml library available?

2019-05-03 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2019-05-02 at 09:28 -0700, H. S. Teoh via Digitalmars-d-learn
wrote:
> On Thu, May 02, 2019 at 05:23:29PM +0100, Russel Winder via
> Digitalmars-d-learn wrote:
> [...]
> > There are situations where you create a binding in preference to
> > writing something from scratch. cf. gtk, gstreamer, etc. so why not
> > libxml2?
> [...]
> 
> No particular reason, except nobody has taken up the task yet. Would
> you?

If I were interested in XML processing yes I would. However, just at
the moment I am doing things with MPEG-TS and gstreamer-rs. I may
investigate the analogue for GstreamerD.

On the other hand there are enough people moaning about std.xml and the
general lack of quality, high performance D support for XML that there
is clearly a lot of people who should be interested in creating a D
binding to libxml2.
 
-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



signature.asc
Description: This is a digitally signed message part


Re: Mixin can't access library symbols?

2019-05-03 Thread faissaloo via Digitalmars-d-learn

On Friday, 3 May 2019 at 17:51:39 UTC, Adam D. Ruppe wrote:

On Friday, 3 May 2019 at 17:48:50 UTC, faissaloo wrote:
How can I get a mixin to implicitly include the symbols from 
its surrounding context? Is this possible?


What's your big picture goal? Do you have sample code you have 
tried so far?


Also, are you talking mixin("string") or mixin template? They 
work differently with symbols too.


My sample code is too big to be useful. The use of my mixin looks 
like:


mixin(defState!("XEvent value;"));

But it tells me it can't find the symbol XEvent despite me having 
used it elsewhere.


Re: Mixin can't access library symbols?

2019-05-03 Thread Adam D. Ruppe via Digitalmars-d-learn

On Friday, 3 May 2019 at 17:48:50 UTC, faissaloo wrote:
How can I get a mixin to implicitly include the symbols from 
its surrounding context? Is this possible?


What's your big picture goal? Do you have sample code you have 
tried so far?


Also, are you talking mixin("string") or mixin template? They 
work differently with symbols too.


Mixin can't access library symbols?

2019-05-03 Thread faissaloo via Digitalmars-d-learn
How can I get a mixin to implicitly include the symbols from its 
surrounding context? Is this possible?


Blog Post #0032 - Menu Accelerator Keys

2019-05-03 Thread Ron Tarrant via Digitalmars-d-learn
An accelerating post for a rainy Friday (well, it's raining here, 
at least) all about menu accelerator keys. Here's the link: 
http://gtkdcoding.com/2019/05/03/0032-accelerator_keys.html


Re: OT - Git training Lon/HK and book recommendation on taste in programming

2019-05-03 Thread Russel Winder via Digitalmars-d-learn
On Wed, 2019-05-01 at 09:51 +, Laeeth Isharc via Digitalmars-d-
learn wrote:
> Hi.
> 
> First question - can anyone recommend git / Gitlab training 
> providers in HK and London?  Two distinct audiences - highly 
> intelligent people that may or may not really program, and 
> experienced developers with a finance background that could 
> benefit from knowing how to use git properly (finance is often in 
> the dark ages).

There were some sessions on Git at ACCU 2019 they might prove useful to
the programmer audience, but definitely not the non-programmer
audience!

The presenters of the sessions are, I believe full time employees and
so not available for  training workshops. Some of them would be fine
with programmers and totally useless with non-programmers. Some of them
though have the empathy to work with either. It might be worth
approaching them to see if they are interested in "on the side" work.

Otherwise there are some UK-based trainers who know Git well enough,
and have the empathy to deal with the non-programmers, but whether they
could stay ahead of the programmers with Git is an open question. But
then co-learning is a standard approach if they know that way of
working.

-- 
Russel.
===
Dr Russel Winder  t: +44 20 7585 2200
41 Buckmaster Roadm: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk



signature.asc
Description: This is a digitally signed message part


Re: Cast ptr/len to D-style array

2019-05-03 Thread Ali Çehreli via Digitalmars-d-learn

On 05/02/2019 08:21 PM, James Blachly wrote:

On 5/2/19 4:05 PM, ag0aep6g wrote:

Just slice the pointer with the length:

 int* ptr;
 size_t len;
 int[] arr = ptr[0 .. len];


Perfect thanks. I searched but without using the magic word "slice" I 
couldn't find meaningful results.


Thanks again.


Looks like I indexed it under "slice from pointer":


http://ddili.org/ders/d.en/pointers.html#ix_pointers.slice%20from%20pointer

Ali



Re: dmd + optlink Symbol Undefined _StretchDIBits@52

2019-05-03 Thread Dennis via Digitalmars-d-learn

On Friday, 3 May 2019 at 06:20:37 UTC, Mike Parker wrote:
If you compile with -m32mscoff for 32-bit or -m64, DMD will use 
the Microsoft linker and import libraries if you have Visual 
Studio or the MS Build tools installed, and the LDC linker with 
some import libraries from MinGW if you don’t.


I don't know if it's specific to me, but with dmd and mscoff I 
found the need to explicitly mention that I wanted to use the 
import libraries.


E.g. looking at the requirements section of the docs:
(https://docs.microsoft.com/en-us/windows/desktop/api/wingdi/nf-wingdi-stretchdibits)

I would put this in my code:
pragma(lib, "Gdi32.lib");


Re: CTFE sort of tuples

2019-05-03 Thread Timon Gehr via Digitalmars-d-learn

On 02.05.19 09:28, Stefan Koch wrote:

On Thursday, 2 May 2019 at 02:54:03 UTC, Andrey wrote:

Hello, I have got this code:


    [...]


I want to sort array of tuples using "data" element in CTFE. But this 
code give me errors:

[...]


As I understand the function "sort" sometimes can't be run at CT 
because of reinterpreting cast.

In this case how to sort?


write a sort?

a bubble-sort should be sufficient for if the arrays are as short as in 
the example.


Well, clearly, we should be able to /swap values/ at compile time.


Re: dmd + optlink Symbol Undefined _StretchDIBits@52

2019-05-03 Thread Mike Parker via Digitalmars-d-learn

On Thursday, 2 May 2019 at 22:54:20 UTC, Joshua Hodkinson wrote:

Hi everyone,

I am getting a linker error when compiling with dmd (v2.085.1) 
when using StrechDIBits from the win32 api.


Error 42: Symbol Undefined _StretchDIBits@52

However with ldc (v1.15.0) the program compiles correctly.

Wondering if I've missed something here, or possibly identified 
a bug with dmd?


Thanks


By default, DMD uses the Optlink linker and some quite old system 
import libraries in the OMF format. They’re missing a number of 
functions. If you compile with -m32mscoff for 32-bit or -m64, DMD 
will use the Microsoft linker and import libraries if you have 
Visual Studio or the MS Build tools installed, and the LDC linker 
with some import libraries from MinGW if you don’t.