Re: What's best practice to use compound literals with structs and C-APIs?

2019-05-02 Thread Robert M. Münch via Digitalmars-d-learn
On 2019-05-01 19:13:54 +, Alex said: Doesn't work because this seems to kick in some D releated run-time stuff which lead to unresolved externals during linking: error LNK2001: Nicht aufgelöstes externes Symbol "...__initZ". error LNK2001: Nicht aufgelöstes externes Symbol "...__xtoHashFN

Re: CTFE sort of tuples

2019-05-02 Thread Stefan Koch via Digitalmars-d-learn
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.

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

2019-05-02 Thread Radu via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote: Second question. Lots of people these days start to program to solve their problems at work but they may never have been shown the basic principles of design, structuring and maintenance of their code. If I could give them one bo

Re: What's best practice to use compound literals with structs and C-APIs?

2019-05-02 Thread Alex via Digitalmars-d-learn
On Thursday, 2 May 2019 at 07:11:37 UTC, Robert M. Münch wrote: On 2019-05-01 19:13:54 +, Alex said: Doesn't work because this seems to kick in some D releated run-time stuff which lead to unresolved externals during linking: error LNK2001: Nicht aufgelöstes externes Symbol "...__initZ".

Re: dmd -unittest -main -run: undefined reference to `_D1c12__ModuleInfoZ'

2019-05-02 Thread ag0aep6g via Digitalmars-d-learn
On 02.05.19 01:18, kdevel wrote: Now I have: a/main.d a/b/package.d a/b/c/package.d b/package.d and c/package.d as before. For reference, a/b/c/package.d is this: module c; package import std.file; And a/b/package.d starts with: module b; import c; a/main.d is ``` import b; void

Re: druntime giving wrong line for copy assert?

2019-05-02 Thread Rudy Raab via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 12:29:18 UTC, Rudy Raab wrote: On Tuesday, 30 April 2019 at 20:35:11 UTC, Bastiaan Veelo wrote: On Tuesday, 30 April 2019 at 13:59:52 UTC, Rudy Raab wrote: The error was on line 36, which is the format, not my bad slice. Is there a reason for this, or is it a bug T

Re: Any full feature xml library available?

2019-05-02 Thread Russel Winder via Digitalmars-d-learn
On Thu, 2019-05-02 at 02:11 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] > > It does not. Those features come under the big bad guys feature list. > > Gonna have to go to C for it. Surely that means you can use Python, Rust, C++, or D rather than having to descend to using C? lib

Re: Setting process name

2019-05-02 Thread Arun Chandrasekaran via Digitalmars-d-learn
On Wed, May 1, 2019 at 7:50 PM Anonymouse via Digitalmars-d-learn wrote: > > Is there a way of setting the process/thread name that's neater > than this? > > import core.sys.posix.pthread; > > extern(C) int pthread_setname_np(pthread_t, const char*); > > void main() > { > import std.string :

Re: Any full feature xml library available?

2019-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2019 3:36 AM, Russel Winder wrote: On Thu, 2019-05-02 at 02:11 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] It does not. Those features come under the big bad guys feature list. Gonna have to go to C for it. Surely that means you can use Python, Rust, C++, or D rather

Re: Any full feature xml library available?

2019-05-02 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2019-05-03 at 03:50 +1200, rikki cattermole via Digitalmars-d- learn wrote: > On 03/05/2019 3:36 AM, Russel Winder wrote: > > […] > > libxml2 is definitely usable from Python, it must be usable from D. > > Of > > course, I am assuming libxml2 has the facilities required. > > libxml2 is pr

Re: Any full feature xml library available?

2019-05-02 Thread H. S. Teoh via Digitalmars-d-learn
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 t

Re: Any full feature xml library available?

2019-05-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Thursday, 2 May 2019 at 15:50:53 UTC, rikki cattermole wrote: On 03/05/2019 3:36 AM, Russel Winder wrote: On Thu, 2019-05-02 at 02:11 +1200, rikki cattermole via Digitalmars-d- learn wrote: […] It does not. Those features come under the big bad guys feature list. Gonna have to go to C f

Re: Any full feature xml library available?

2019-05-02 Thread rikki cattermole via Digitalmars-d-learn
On 03/05/2019 4:23 AM, Russel Winder wrote: On Fri, 2019-05-03 at 03:50 +1200, rikki cattermole via Digitalmars-d- learn wrote: On 03/05/2019 3:36 AM, Russel Winder wrote: […] libxml2 is definitely usable from Python, it must be usable from D. Of course, I am assuming libxml2 has the facilit

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

2019-05-02 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc 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 backgrou

Re: What's best practice to use compound literals with structs and C-APIs?

2019-05-02 Thread Jacob Carlborg via Digitalmars-d-learn
On 2019-05-01 14:47, Robert M. Münch wrote: I use some C library that uses structs and many functions that use pointer to structs as arguments: struct A {...}; myfunc(A *myA); In C you can do this to get a lvalue: myfunc(&(A){...}); In D this doesn't work and I get an "is not an lvalue and c

Cast ptr/len to D-style array

2019-05-02 Thread James Blachly via Digitalmars-d-learn
I work a lot with C functions, many of which yield pointer + length. Is there a way to cast this or materialize a D-style array backed by the already allocated data (with length) to avoid copies which slow things down? I recognize memory management is a complication. Typically, I would be res

Re: Cast ptr/len to D-style array

2019-05-02 Thread ag0aep6g via Digitalmars-d-learn
On 02.05.19 22:03, James Blachly wrote: I work a lot with C functions, many of which yield pointer + length. Is there a way to cast this or materialize a D-style array backed by the already allocated data (with length) to avoid copies which slow things down? Just slice the pointer with the l

dmd + optlink Symbol Undefined _StretchDIBits@52

2019-05-02 Thread Joshua Hodkinson via Digitalmars-d-learn
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 b

Linking to OpenCV OSX (dub.json LFLAG)

2019-05-02 Thread Fred via Digitalmars-d-learn
Hey Guys, Complete Dlang n00b here and I'm having awful problems linking to opencv using my projects dub.json. I've been getting some help on Github (https://github.com/aferust/opencvd/issues/1) but had no luck so far, if anyone has any good ideas I'd ever so greatful! Thanks

Re: Linking to OpenCV OSX (dub.json LFLAG)

2019-05-02 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, May 02, 2019 at 11:24:12PM +, Fred via Digitalmars-d-learn wrote: > Hey Guys, > > Complete Dlang n00b here and I'm having awful problems linking to > opencv using my projects dub.json. > > I've been getting some help on Github > (https://github.com/aferust/opencvd/issues/1) but had no

Re: Linking to OpenCV OSX (dub.json LFLAG)

2019-05-02 Thread Fred via Digitalmars-d-learn
On Thursday, 2 May 2019 at 23:33:17 UTC, H. S. Teoh wrote: On Thu, May 02, 2019 at 11:24:12PM +, Fred via Digitalmars-d-learn wrote: Hey Guys, Complete Dlang n00b here and I'm having awful problems linking to opencv using my projects dub.json. I've been getting some help on Github (http

Re: Linking to OpenCV OSX (dub.json LFLAG)

2019-05-02 Thread Fred via Digitalmars-d-learn
On Thursday, 2 May 2019 at 23:38:29 UTC, Fred wrote: On Thursday, 2 May 2019 at 23:33:17 UTC, H. S. Teoh wrote: On Thu, May 02, 2019 at 11:24:12PM +, Fred via Digitalmars-d-learn wrote: [...] [...] Do you have any specific error messages and/or other problems that you could post here? B

Re: Cast ptr/len to D-style array

2019-05-02 Thread James Blachly via Digitalmars-d-learn
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.

Re: dmd + optlink Symbol Undefined _StretchDIBits@52

2019-05-02 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. Wo