Re: Call method with Variant array as parameters

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 14 July 2018 at 11:37:20 UTC, Timoses wrote: On Saturday, 14 July 2018 at 11:08:21 How about this? import std.variant: Variant; import std.traits : isCallable; class Foo { void bar(string s, long l) { import std.stdio : writeln; writeln(s); writeln(l);

Call method with Variant array as parameters

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
Hi, I have a class with methods and I want to call a method by using a variant array. The length of the array and the types exactly fits the method signature. In the last line of main you see the coding which should be generated. I need some coding which looks at the signature of bar and

Find out druntime/import and phobos folder on Linux

2018-07-14 Thread Andre Pany via Digitalmars-d-learn
Hi, The IntelliJ D Language plugin has support for D-scanner and DCD. Both tools needs to know the paths to druntime/import and Phobos source folder. In IntelliJ you set the path to the folder where dmd binary is located. Based on this information on Windows and MacOS it is possible to

ranges.chunks and map! does not work

2018-07-05 Thread Andre Pany via Digitalmars-d-learn
Hi, the purpose of this code is to generate CSV based on 3 double arrays. I wonder why map cannot directly use the result of the chunks function. import std.experimental.all; void main() { double[] timestamps = [1.1]; double[] temperatures = [2.2]; double[] pressures = [3.3];

Re: ranges.chunks and map! does not work

2018-07-05 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 5 July 2018 at 12:00:03 UTC, vit wrote: On Thursday, 5 July 2018 at 09:47:32 UTC, Andre Pany wrote: [...] roundRobin doesn't return RandomAccessRange => chunks doesn't return range of RandomAccessRange => Error: no [] operator overload try this: string content =

DLL: (const char *paramNames[],size_t numParams)

2018-07-09 Thread Andre Pany via Digitalmars-d-learn
Hi, I need to call a C function within a DLL which has following signature: void GetParamNames (const char *paramNames[], size_t numParams); The purpose of this function is to return a list of texts I defined in D: extern(C) GetParamNames (const char[]* paramNames, size_t numParams); Is

Re: DLL: (const char *paramNames[],size_t numParams)

2018-07-09 Thread Andre Pany via Digitalmars-d-learn
On Monday, 9 July 2018 at 10:38:54 UTC, Basile B. wrote: On Monday, 9 July 2018 at 10:33:03 UTC, Andre Pany wrote: Hi, no it's not correct i think, right translation would be extern(C) void GetParamNames(const char** paramNames, size_t numParams); If you use the D array syntax you'll get

Re: DLL: (const char *paramNames[],size_t numParams)

2018-07-09 Thread Andre Pany via Digitalmars-d-learn
On Monday, 9 July 2018 at 10:56:18 UTC, Andre Pany wrote: On Monday, 9 July 2018 at 10:38:54 UTC, Basile B. wrote: On Monday, 9 July 2018 at 10:33:03 UTC, Andre Pany wrote: Hi, no it's not correct i think, right translation would be extern(C) void GetParamNames(const char** paramNames,

Re: DLL: (const char *paramNames[],size_t numParams)

2018-07-09 Thread Andre Pany via Digitalmars-d-learn
On Monday, 9 July 2018 at 11:39:46 UTC, Basile B. wrote: Ok, i've read your other answers and it seems that you have a way to test so i think you'll figure it out yourself, but you don't need to alloc. Once the fromStringz verified to be good maybe dup/idup in case the C lib free the stuff

Re: DLL: (const char *paramNames[],size_t numParams)

2018-07-09 Thread Andre Pany via Digitalmars-d-learn
On Monday, 9 July 2018 at 13:48:05 UTC, Kagamin wrote: Correct signature: extern(C) void GetParamNames(const(char)** paramNames, size_t numParams); In C const applies only to the nearest member. Thank you, that looks great. Kind regards Andre

Re: Why does struct initializer works for arrays but not for associative arrays?

2018-03-14 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 15:17:54 UTC, Jonathan M Davis wrote: On Wednesday, March 14, 2018 13:36:51 Andre Pany via Digitalmars-d-learn wrote: [...] Well, I think that you have two issues here: 1. Struct literals work in only a few, specific circumstances. Why, I don't know, but IIRC

Why does struct initializer works for arrays but not for associative arrays?

2018-03-14 Thread Andre Pany via Digitalmars-d-learn
Hi, I do not understand why struct initializer works for arrays but not for associative arrays: struct Bar { string s; } struct Foo { Bar[string] asso; Bar[] arr; } void main() { Foo foo = { arr: [{s: "123"}], asso: ["0": {s: "123"}] // does not work }; }

Re: Spurious error: Process does not exist or is not a child process.

2018-04-12 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 12 April 2018 at 06:45:36 UTC, Andre Pany wrote: Hi, I compiled a linux application on my pc (Windows subsystem for Linux) and copied it to AWS EMR (linux) system. I found the issue. In addition to the AWS client I also start other applications which might become zombie

Spurious error: Process does not exist or is not a child process.

2018-04-12 Thread Andre Pany via Digitalmars-d-learn
Hi, I compiled a linux application on my pc (Windows subsystem for Linux) and copied it to AWS EMR (linux) system. The application should execute the console application "aws". Most of the time the exception "Process does not exist or is not a child process." is raised. If I execute the

Re: Create D binding for C struct containing templated class

2018-06-29 Thread Andre Pany via Digitalmars-d-learn
On Friday, 29 June 2018 at 01:38:23 UTC, evilrat wrote: On Thursday, 28 June 2018 at 18:43:11 UTC, Andre Pany wrote: [...] No, unfortunately D cannot interface with C templates, only C++ templates. But just by coincidence this is C++ source code (and so the templates). So it is possible

Create D binding for C struct containing templated class

2018-06-28 Thread Andre Pany via Digitalmars-d-learn
Hi, I try to write a binding for the GRPC core. There is a struct which has some ugly fields: (https://github.com/grpc/grpc/blob/master/src/core/lib/surface/call.cc#L229) struct grpc_call { gpr_refcount ext_ref; gpr_arena* arena; ... grpc_core::ManualConstructor sending_stream;

Re: D-oriented Syntax Highlighting Plugin for WordPress?

2019-01-01 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 1 January 2019 at 14:46:15 UTC, Ron Tarrant wrote: I've found a ton of syntax highlighter plugins for WordPress, but none that admit to supporting D. Anyone know of one? Or, short of that, perhaps a different site build/management tool (read: not WordPress) with decent D syntax

Re: How to include curl.lib?

2019-01-17 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 17 January 2019 at 20:05:27 UTC, Head Scratcher wrote: On Monday, 14 January 2019 at 18:45:27 UTC, Head Scratcher wrote: The following text is in the source code for curl.d: Windows x86 note: A DMD compatible libcurl static library can be downloaded from the dlang.org $(LINK2

Re: How to include curl.lib?

2019-01-18 Thread Andre Pany via Digitalmars-d-learn
On Friday, 18 January 2019 at 15:49:09 UTC, Head Scratcher wrote: On Thursday, 17 January 2019 at 20:42:48 UTC, Andre Pany wrote: You do not need to specify curl.lib but you have to bundle your executable with curl.dll. Recent Windows 10 versions might even come with curl.dll but I am not

Re: Is there any working SQLite driver for windows?

2018-12-26 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 26 December 2018 at 08:19:03 UTC, Suliman wrote: Yesterday I tried several sqlite drivers and all of them have some issue that make it's build on Windows impossible. Few examples https://github.com/huntlabs/hunt-database/issues/24 https://github.com/biozic/d2sqlite3/issues/51

Re: How to split strings into AA using phobos

2018-12-11 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 11 December 2018 at 08:20:32 UTC, Arun Chandrasekaran wrote: A typical example would be to split the HTTP query string into an AA. vibe.d has req.queryString, but no convenient wrapper to access it as an AA. http://localhost/hello?name=abc=123 I've got this far. auto

Re: dub is building docs of dependencies

2018-12-05 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 5 December 2018 at 02:08:13 UTC, Jedzia wrote: dmd2-2.083.0, win minimal dub init with dub.json: { "description": "A minimal D application.", "dependencies": { "iz": "~>0.6.23" }, "authors": [ "Jedzia" ],

Re: ddox and exempting dependencies

2018-12-05 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 5 December 2018 at 15:55:45 UTC, Anonymouse wrote: As far as I understand you use dub.json "-ddoxFilterArgs": [ "--ex", "pattern" ] to make ddox exclude files from the documentation it generates. However, it still parses, warns and errors out on dependencies, even if they're set

Re: Nested sub packages in dub

2018-12-02 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 2 December 2018 at 09:17:59 UTC, Domain wrote: How to do that? As far as I know dub does not support nested sub packages. You could create a second dub package B with sub package B1 and reference it from your sub package A1. Kind regards Andre

Re: dub is building docs of dependencies

2018-12-06 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 6 December 2018 at 14:09:34 UTC, Jedzia wrote: On Wednesday, 5 December 2018 at 12:00:45 UTC, Andre Pany wrote: [...] Thank you Andre, but that refers to ddox which is badly applicable under windows, thanks to the "Unexpected OPTLINK Termination at EIP=." problem. A

Re: Integrate vibe.d into Windows Service

2018-11-21 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 21 November 2018 at 15:05:31 UTC, Kagamin wrote: Start vibe in another thread and return from ServiceMain, see https://docs.microsoft.com/en-us/windows/desktop/Services/service-servicemain-function also ideally you should report running state only after vibe initialized, opened

Re: dub + ddoc

2018-11-21 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 21 November 2018 at 19:24:52 UTC, Antonio Corbi wrote: Hi! I'm trying to build the docs for my project with `dub -b docs` and dub also generates the docs for the dependencies of my project. Is it possible to generate the docs *only* for my code? Thx! As far as I understand

Re: Integrate vibe.d into Windows Service

2018-11-23 Thread Andre Pany via Digitalmars-d-learn
On Friday, 23 November 2018 at 21:35:57 UTC, Andre Pany wrote: On Friday, 23 November 2018 at 21:27:26 UTC, Kagamin wrote: You don't need to initialize runtime because it's initialized by standard D startup code, but you need to attach threads that are not created by D or static constructors

Re: Integrate vibe.d into Windows Service

2018-11-23 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 21 November 2018 at 15:05:31 UTC, Kagamin wrote: Start vibe in another thread and return from ServiceMain, see https://docs.microsoft.com/en-us/windows/desktop/Services/service-servicemain-function also ideally you should report running state only after vibe initialized, opened

Re: Integrate vibe.d into Windows Service

2018-11-23 Thread Andre Pany via Digitalmars-d-learn
On Friday, 23 November 2018 at 21:27:26 UTC, Kagamin wrote: You don't need to initialize runtime because it's initialized by standard D startup code, but you need to attach threads that are not created by D or static constructors won't be run and only C-level code would work there. Thank

Re: How to get all modules in a package at CT?

2018-11-25 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 24 November 2018 at 08:44:19 UTC, Domain wrote: I have a package named command, and many modules inside it, such as command.build, command.pack, command.help... I want to get all these modules at compile time so that I know what command is available. As far as I understand there

Integrate vibe.d into Windows Service

2018-11-21 Thread Andre Pany via Digitalmars-d-learn
Hi, I translated the CPP example of a windows service to D. https://docs.microsoft.com/en-us/windows/desktop/Services/svc-cpp I wonder how can I integrate a vibe.d http server here: __gshared HANDLE ghSvcStopEvent = NULL; VOID SvcInit(DWORD dwArgc, LPTSTR* lpszArgv) { ghSvcStopEvent =

Re: subsystem:windows and writeln

2018-11-17 Thread Andre Pany via Digitalmars-d-learn
On Friday, 16 November 2018 at 17:36:01 UTC, Domain wrote: When I link the app with /subsystem:windows, and all writeln and writefln will cause a enforcement failed (stdio.d:2889). I think this is unacceptable. Another option is to enhance / correct the third party component if possible. You

Pass reference to void*

2019-01-07 Thread Andre Pany via Digitalmars-d-learn
Hi, I call a C function from a dll (SO on linux). While the following code works fine for DMD on windows, there are strange errors for LDC on windows. Also the equivalent code does not work for DMD/LDC on linux. (When calling other functions from the dll and passing the model reference, this

Re: Pass reference to void*

2019-01-07 Thread Andre Pany via Digitalmars-d-learn
On Monday, 7 January 2019 at 13:01:57 UTC, Stefan Koch wrote: On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote: Hi, I call a C function from a dll (SO on linux). While the following code works fine for DMD on windows, there are strange errors for LDC on windows. Also the

Re: Pass reference to void*

2019-01-09 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 9 January 2019 at 18:37:57 UTC, Stefan Koch wrote: On Monday, 7 January 2019 at 13:15:44 UTC, Andre Pany wrote: On Monday, 7 January 2019 at 13:01:57 UTC, Stefan Koch wrote: On Monday, 7 January 2019 at 12:19:57 UTC, Andre Pany wrote: [...] From the function declaration seems

Re: cant run unittests

2018-12-09 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 8 December 2018 at 19:25:41 UTC, Andrew Pennebaker wrote: On Saturday, 16 July 2016 at 20:22:15 UTC, Seb wrote: On Thursday, 14 July 2016 at 10:13:38 UTC, dom wrote: On Thursday, 14 July 2016 at 00:33:50 UTC, ethgeh wrote: On Wednesday, 13 July 2016 at 19:41:53 UTC, dom wrote:

Re: using dub to compile plugins

2018-12-19 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 12:57:14 UTC, Codifies wrote: I am currently using this dub.sdl name"runz80" targetType "executable" lflags "libz80/libz80.a" however I will be creating a number of plugins, each plugin will consist of a single source file, I'd like the plugin

Re: using dub to compile plugins

2018-12-19 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 19 December 2018 at 14:08:10 UTC, Codifies wrote: On Wednesday, 19 December 2018 at 13:14:20 UTC, Andre Pany wrote: On Wednesday, 19 December 2018 at 12:57:14 UTC, Codifies wrote: [...] You can use dub sub packages. Each plugin will be a dub package with its own dub descriptor

Re: Get attributes of a field?

2019-04-02 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 2 April 2019 at 13:36:47 UTC, Alex wrote: On Tuesday, 2 April 2019 at 13:23:37 UTC, Alex wrote: __traits(getAttributes, T) Requires a type and a field is unfortunately not a type ;/ I'd like to be able to get the attributes without having to instantiate the base type because

Re: Get this error running the D blog about containerizing D in Docker

2019-03-27 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 26 March 2019 at 21:58:49 UTC, WhatMeWorry wrote: On Tuesday, 26 March 2019 at 21:20:06 UTC, Andre Pany wrote: On Tuesday, 26 March 2019 at 17:36:15 UTC, WhatMeWorry wrote: [...] This error should not occur in recent versions of dub. Which dub version do you have (dub

Re: Calling D library from other languages on linux using foreign threads

2019-03-23 Thread Andre Pany via Digitalmars-d-learn
On Friday, 22 March 2019 at 19:34:14 UTC, tchaloupka wrote: I've searched a lot at it should be working at least on linux, but apparently is not or I'm doing something totally wrong.. [...] I just noticed another issue which might be related but I doubt.

Re: Shared library loading and static constructor

2019-03-23 Thread Andre Pany via Digitalmars-d-learn
On Friday, 22 March 2019 at 17:52:34 UTC, Sobaya wrote: On Friday, 22 March 2019 at 11:00:32 UTC, Andre Pany wrote: On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote: [...] As far as I know different to windows, linus will not search current working directory for a.so. if this is the

Re: Issues with std.net.curl on Win 10 x64

2019-03-25 Thread Andre Pany via Digitalmars-d-learn
On Monday, 25 March 2019 at 16:25:37 UTC, cptgrok wrote: I need to review syslogs for over 160 systems monthly, and I am trying to write a utility to automate bulk downloads from a custom web service where they are hosted. I need to calculate a date range for the prior month, add start and end

Re: Get this error running the D blog about containerizing D in Docker

2019-03-26 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 26 March 2019 at 17:36:15 UTC, WhatMeWorry wrote: https://dlang.org/blog/2019/03/14/containerize-your-d-server-application/ I'm following the excellent blog posting by Mr. Nacke, but I keep getting the following error when I attempt to compile hellorest with dub. Since everything

Re: Error with matplotlib

2019-02-18 Thread Andre Pany via Digitalmars-d-learn
On Monday, 18 February 2019 at 21:28:14 UTC, Samir wrote: On Monday, 18 February 2019 at 20:30:23 UTC, Andre Pany wrote: [...] Thank you for that! After installing the version of matplotlib for python2 and rerunning dub build, I now get the following error: $ dub build Performing "debug"

Is std.experimental.logger FileLogger thread safe?

2019-02-25 Thread Andre Pany via Digitalmars-d-learn
Hi, I am using the Arsd cgi class (https://github.com/adamdruppe/arsd) to spawn an http server. Each http request is handled in its own thread. Is it safe to set in void main a FileLogger to which each thread will write to? void main() { ... sharedLog = new

Re: Error with matplotlib

2019-02-19 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 00:05:46 UTC, Samir wrote: On Monday, 18 February 2019 at 21:50:25 UTC, Andre Pany wrote: In the meantime you could adapt the python script on your local file system in the dub packages cache folder as described here

static if, compiler bug?

2019-03-03 Thread Andre Pany via Digitalmars-d-learn
Hi, in druntime https://github.com/dlang/druntime/blob/master/src/core/sys/posix/sys/types.d#L113 there is following definiton: else version (CRuntime_Musl) { alias long blksize_t; alias ulong nlink_t; alias long dev_t; alias long blkcnt_t; alias ulong

Re: Purpose of template DECLARE_HANDLE in druntime

2019-02-26 Thread Andre Pany via Digitalmars-d-learn
On Friday, 1 February 2019 at 08:12:23 UTC, Andre Pany wrote: On Friday, 1 February 2019 at 07:35:34 UTC, Kagamin wrote: It's a strong typed handle, in C it's declared as #ifdef STRICT typedef void *HANDLE; #if 0 && (_MSC_VER > 1000) #define DECLARE_HANDLE(name) struct name##__; typedef struct

Re: use dll's

2019-03-16 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 16 March 2019 at 12:53:49 UTC, ontrail wrote: hi, i created a program (windows) and 2 dll's. how do i use the 2 d-language dll's in a d-language program with only one GC? any help is appreciated. It is explained here (section d code calling d code in dll)

Re: how to complie a x64 dll wiht a x64 host exe? i need the command line code.

2019-03-16 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 16 March 2019 at 10:46:32 UTC, ll wrote: On Friday, 15 March 2019 at 15:08:48 UTC, Andre Pany wrote: On Friday, 15 March 2019 at 09:22:35 UTC, ll wrote: [...] There is an open pr for dub. X64 will then automatically be used if your system is capable. For now you have to use

Re: how to complie a x64 dll wiht a x64 host exe? i need the command line code.

2019-03-15 Thread Andre Pany via Digitalmars-d-learn
On Friday, 15 March 2019 at 09:22:35 UTC, ll wrote: i see a simple dll creation in sample fold, but i am confused with the command line and i donnot know how to complie a x64 dll wiht a x64 host exe. i think need a clear command line arguments. There is an open pr for dub. X64 will then

Re: what am I missing here with that working dir?

2019-03-18 Thread Andre Pany via Digitalmars-d-learn
On Monday, 18 March 2019 at 15:23:46 UTC, DFTW wrote: On Saturday, 16 March 2019 at 07:27:43 UTC, FreeSlave wrote: On Friday, 15 March 2019 at 21:48:50 UTC, DFTW wrote: What am I missing here? Maybe the terminal and your utility you run wkhtmltopdf from have different environment? I

Re: what am I missing here with that working dir?

2019-03-18 Thread Andre Pany via Digitalmars-d-learn
On Monday, 18 March 2019 at 15:39:39 UTC, Andre Pany wrote: On Monday, 18 March 2019 at 15:23:46 UTC, DFTW wrote: On Saturday, 16 March 2019 at 07:27:43 UTC, FreeSlave wrote: [...] I guessed so, I've tried set the env as well: enum env = ["LD_LIBRARY_PATH" :

Re: is collectException working for every exceptions ?

2019-03-18 Thread Andre Pany via Digitalmars-d-learn
On Monday, 18 March 2019 at 18:54:22 UTC, Roman Sztergbaum wrote: Hello as the subject say i'm asking this question because with the following code ``` private config_create_answer create_config(string[] args) in { assert(args !is null, "args cannot be null");

Re: Reading data from the network without knowing the size of the buffer that is coming

2019-03-21 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 21 March 2019 at 16:54:01 UTC, Roman Sztergbaum wrote: Hello ! in my function : ```D private config_load_answer load_config(string[] args) in(args !is null, "args cannot be null") in(args.length == 2, "need 1 arguments") out(r; r.state == "SUCCESS", "load_config

Re: Shared library loading and static constructor

2019-03-22 Thread Andre Pany via Digitalmars-d-learn
On Friday, 22 March 2019 at 10:51:58 UTC, Sobaya wrote: I fail to load the shared library created in a specific situation, but I do not know the cause. a.d import b.d b.d static this() {} for above 2 files, I created shared library by following command. dmd a.d -shared

Re: Linux & DMD & GtkD

2019-02-16 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote: On Saturday, 16 February 2019 at 14:29:56 UTC, Russel Winder wrote: Pass, sorry. Thanks for the replies, guys... I quoted the above line because it's just about the only thing I understood. Let me explain... It's been

Re: Linux & DMD & GtkD

2019-02-16 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 16 February 2019 at 16:37:17 UTC, Andre Pany wrote: On Saturday, 16 February 2019 at 16:28:09 UTC, Ron Tarrant wrote: [...] Create a file sample1.d with following content #!/usr/bin/env dub /+ dub.sdl: dependency "vibe-d" version="~>0.8.0" +/ void main() { import vibe.d;

Re: Error with matplotlib

2019-02-18 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 17 February 2019 at 20:19:23 UTC, Samir wrote: I am trying to run the code from the "Simple Example" listed in the matplotlib-d package page[1] and am running into the following error: [...] This dub packages enables you to call python coding from D. In this specific case

Re: Error with matplotlib

2019-02-18 Thread Andre Pany via Digitalmars-d-learn
On Monday, 18 February 2019 at 19:24:52 UTC, Samir wrote: On Monday, 18 February 2019 at 18:27:17 UTC, Andre Pany wrote: Therefore python needs to be installed and also matplotlib.pyplot. Hi Andre, I do have both python3 and matplotlib installed: $ python3 Python 3.6.7 (default, Jan 10

Re: Generators in D

2019-02-19 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 19 February 2019 at 18:37:22 UTC, Matthew_Blake wrote: Hi there, is the concept of generators (like in Python, using yield) available in D? If so, where can I find information? Regards I do not know python well, but do you search for this one?

Purpose of template DECLARE_HANDLE in druntime

2019-01-31 Thread Andre Pany via Digitalmars-d-learn
Hi, I noticed in druntime this template is used often: package template DECLARE_HANDLE(string name, base = HANDLE) { mixin ("alias " ~ base.stringof ~ " " ~ name ~ ";"); The disadvantage is, IDEs like IntelliJ are not able to find the symbols using this template e.g. mixin

Re: Purpose of template DECLARE_HANDLE in druntime

2019-02-01 Thread Andre Pany via Digitalmars-d-learn
On Friday, 1 February 2019 at 07:35:34 UTC, Kagamin wrote: It's a strong typed handle, in C it's declared as #ifdef STRICT typedef void *HANDLE; #if 0 && (_MSC_VER > 1000) #define DECLARE_HANDLE(name) struct name##__; typedef struct name##__ *name #else #define DECLARE_HANDLE(name) struct

Re: lld-link.exe: error: could not open msvcrt100.lib

2019-02-01 Thread Andre Pany via Digitalmars-d-learn
On Friday, 1 February 2019 at 13:52:05 UTC, Andre Pany wrote: Hi, lld-link was working fine on my windows pc. I set in global dub settings file architecture to X86_64. DMD was installed by extracting the zip archive. For python development ): I had to install "Build Tools for Visual Studio

lld-link.exe: error: could not open msvcrt100.lib

2019-02-01 Thread Andre Pany via Digitalmars-d-learn
Hi, lld-link was working fine on my windows pc. I set in global dub settings file architecture to X86_64. DMD was installed by extracting the zip archive. For python development ): I had to install "Build Tools for Visual Studio 2017". Now dub (lld-link) fails always with error message:

Re: lld-link.exe: error: could not open msvcrt100.lib

2019-02-01 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 2 February 2019 at 06:50:10 UTC, greatsam4sure wrote: On Friday, 1 February 2019 at 14:00:15 UTC, Andre Pany wrote: On Friday, 1 February 2019 at 13:52:05 UTC, Andre Pany wrote: [...] Already solved in nightly :) Thanks!!! Already solved in nightly. What is the meaning of

Re: Singleton in Action?

2019-02-02 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 2 February 2019 at 19:23:58 UTC, Ron Tarrant wrote: Thanks for the replies, fellow programmers. (generic, unisex, PC, and all-encompassing) If I could trouble someone for a complete working example so I have something to study, that would be excellent. I found here an example:

Re: Vibed + OpenSSL on Windows 10?

2019-01-29 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 29 January 2019 at 10:06:43 UTC, Suliman wrote: On Tuesday, 29 January 2019 at 10:01:04 UTC, Suliman wrote: Always compile vibe.d with mscoff Could you show command to compile with mscoff? I am not sure that all works fine, but at last I do not have linking error. I have add to

Re: I really don't understand DUB

2019-04-14 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 14 April 2019 at 19:46:41 UTC, Ron Tarrant wrote: On Monday, 8 April 2019 at 19:54:28 UTC, WhatMeWorry wrote: [...] Just so you know who I am and what my experience is: I've only been using D for a few months and so far, I've only dabbled in dub. I used to write a blog for

Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-27 Thread Andre Pany via Digitalmars-d-learn
On Monday, 27 May 2019 at 07:16:37 UTC, BoQsc wrote: On Sunday, 26 May 2019 at 20:37:36 UTC, Jon Degenhardt wrote: [...] The desktop computer I'm testing this on contains Solid State Drive, a Windows 10 Home Operating system and about 7-9 years old of hardware. But remember, we are living

Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-25 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote: rdmd is a companion to the dmd compiler that simplifies the typical edit-compile-link-run or edit-make-run cycle to a rapid edit-run cycle. Like make and other tools, rdmd uses the relative dates of the files involved to minimize the

Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-28 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 28 May 2019 at 06:06:24 UTC, Seb wrote: On Tuesday, 28 May 2019 at 05:11:15 UTC, Andre Pany wrote: On Monday, 27 May 2019 at 07:16:37 UTC, BoQsc wrote: [...] I can confirm, without measuring the exact timing, "dmd -run test.d" feels much faster than "rdmd test.d". I would say 1

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Andre Pany via Digitalmars-d-learn
On Friday, 31 May 2019 at 10:47:20 UTC, Mike Parker wrote: On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: What is the correct way? --DRT flags are for run time, not compile time. They're intended to be passed to your executable and not the compiler. From the docs [1]: "By

Re: [dub] Passing --DRT-gcopt to dmd

2019-05-31 Thread Andre Pany via Digitalmars-d-learn
On Friday, 31 May 2019 at 13:37:05 UTC, Anonymouse wrote: On Friday, 31 May 2019 at 10:47:20 UTC, Mike Parker wrote: On Friday, 31 May 2019 at 10:27:44 UTC, Anonymouse wrote: What is the correct way? --DRT flags are for run time, not compile time. They're intended to be passed to your

Inconsistent behavior of __FILE__ within mixin template

2019-05-29 Thread Andre Pany via Digitalmars-d-learn
Hi, I have a module a.d --- struct TestClass { string name; string fileName; } TestClass[] testClasses; mixin template UnitTest() { private static string getFileName(string fileName = __FILE__) { return fileName; } private static this() {

Re: Inconsistent behavior of __FILE__ within mixin template

2019-05-29 Thread Andre Pany via Digitalmars-d-learn
On Wednesday, 29 May 2019 at 16:08:11 UTC, Exil wrote: On Wednesday, 29 May 2019 at 08:45:45 UTC, Andre Pany wrote: [...] I imagine __FILE__ is used where the code is defined, since it is defined in "a.d" that is what is used. If you want to know the file name of where it is used then you

Re: Get module file path from ModuleInfo

2019-06-06 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 6 June 2019 at 10:16:17 UTC, Jacob Carlborg wrote: On Thursday, 6 June 2019 at 04:20:52 UTC, Andre Pany wrote: Hi, I want to enhance a unittest framework to also report the results in SonarQube Generic Execution format. This format lists the file paths. The unittest framework

Get module file path from ModuleInfo

2019-06-05 Thread Andre Pany via Digitalmars-d-learn
Hi, I want to enhance a unittest framework to also report the results in SonarQube Generic Execution format. This format lists the file paths. The unittest framework loops through the modules and collects the module name and the unittests: foreach (moduleInfo; ModuleInfo) { if

Re: Dub dependencies / How to use own Github fork?

2019-05-30 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 30 May 2019 at 16:45:45 UTC, Robert M. Münch wrote: Is there a best practice how I can use a fork if mine of a project that can be access via "dependencies": {...} so that my own code is used? I think that would make it pretty easy to switch between different versions. Github

Re: Specifying executable names in DUB

2019-06-17 Thread Andre Pany via Digitalmars-d-learn
On Tuesday, 18 June 2019 at 02:13:46 UTC, Dave wrote: Greetings, This might be totally obvious, but I can't seem to figure out how to specify an executable's name to be different for each build types in my DUB package. For example, if my project is named "dlang_test", I might want something

Re: meson and d

2019-06-10 Thread Andre Pany via Digitalmars-d-learn
On Monday, 10 June 2019 at 16:51:15 UTC, dkd wrote: hi, In theory though you can point it at any D compiler by setting the "DC" environment variable. i found at early morning, that by setting variable at system level(through my computer->environment setting) meson can detect d. it is the

Re: curl: can't send email?

2019-06-10 Thread Andre Pany via Digitalmars-d-learn
On Monday, 10 June 2019 at 16:10:07 UTC, Andrew wrote: What wrong? ``` import std.net.curl; [...] Curl smtp is a low level api. You need to know SMTP RFC. Please have a look here, this is a high level API on top of curl smtp: https://github.com/adamdruppe/arsd/blob/master/email.d Kind

Re: [windows] Can't delete a closed file?

2019-05-09 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 9 May 2019 at 13:18:44 UTC, Cym13 wrote: On Thursday, 9 May 2019 at 13:02:51 UTC, Rene Zwanenburg wrote: On Thursday, 9 May 2019 at 12:33:37 UTC, Cym13 wrote: On Thursday, 9 May 2019 at 11:31:20 UTC, Cym13 wrote: ... To dismiss any doubt about AV or other processes coming into

Re: [windows] Can't delete a closed file?

2019-05-09 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 9 May 2019 at 10:09:23 UTC, Cym13 wrote: Hi, this is likely not related to D itself but hopefully someone can help me with this since I'm rather new to windows programming, I mainly work on linux. I'm trying to bundle a DLL in a binary, write it in a temp folder, use it and

Re: Nothing at all compiles with -m64 on Windows

2019-05-11 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 11 May 2019 at 09:59:25 UTC, Anonymouse wrote: On Tuesday, 7 May 2019 at 17:33:22 UTC, Ron Tarrant wrote: I've had this happen, too. I don't know for sure, but I think it may be because the installers aren't prepared to do updates, not on Windows, anyway. My best success for

Re: Parsing URL, Extracting Authority from the URL string

2019-05-20 Thread Andre Pany via Digitalmars-d-learn
On Monday, 20 May 2019 at 14:44:50 UTC, Boqsc wrote: I wonder if there is a simple way to extract Authority from an URL string. What is Authority of URL: https://en.wikipedia.org/wiki/URL#Syntax https://dlang.org/phobos/std_path.html I was able to gather the filename of URL via std.path

Re: is there a way to embed python 3.7 code in D program?

2019-05-12 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 12 May 2019 at 20:06:34 UTC, torea wrote: Hi, I'd like to use D for the "brain" of a small robot (Anki vector) whose API is coded in Python 3.6+. I had a look at Pyd but it's limited to python 2.7... Would there be other ways to call python functions and retrieve the python

Re: Unexpected behaviour in associative array

2019-04-19 Thread Andre Pany via Digitalmars-d-learn
On Friday, 19 April 2019 at 11:10:16 UTC, Arredondo wrote: Hi all, I'm using a custom Struct as the key type in an associative array. I have defined the toHash() and opEquals(...) functions, and the problem I'm having is that the test mykey in aa always fails (returns null) even though

Re: Unexpected behaviour in associative array

2019-04-19 Thread Andre Pany via Digitalmars-d-learn
On Friday, 19 April 2019 at 11:53:37 UTC, Andre Pany wrote: On Friday, 19 April 2019 at 11:41:53 UTC, Arredondo wrote: On Friday, 19 April 2019 at 11:32:17 UTC, Andre Pany wrote: Could you please post the coding, otherwise it is quite hard to help you. Kind regards Andre Yes, I'm working

Re: Unexpected behaviour in associative array

2019-04-19 Thread Andre Pany via Digitalmars-d-learn
On Friday, 19 April 2019 at 11:41:53 UTC, Arredondo wrote: On Friday, 19 April 2019 at 11:32:17 UTC, Andre Pany wrote: Could you please post the coding, otherwise it is quite hard to help you. Kind regards Andre Yes, I'm working on isolating the problem. It's a bit laborious because the

Re: Unexpected behaviour in associative array

2019-04-19 Thread Andre Pany via Digitalmars-d-learn
On Friday, 19 April 2019 at 12:03:33 UTC, Arredondo wrote: On Friday, 19 April 2019 at 11:55:41 UTC, Andre Pany wrote: https://dub.pm/commandline.html#dustmite Thanks, but it appears that this tool is used to isolate the cause of build errors, and I'm not having build errors, just

Re: dub preBuildCommand removed?

2019-05-04 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 4 May 2019 at 21:16:25 UTC, James Blachly wrote: the preBuildCommand is no longer listed in the dub format spec[1] although it shows up in the google cache for the page. When was it removed, and why? I can't find any announcement. [1] https://dub.pm/package-format-json.html It

Re: Logging best practices

2019-04-27 Thread Andre Pany via Digitalmars-d-learn
On Thursday, 25 April 2019 at 10:33:00 UTC, Vladimirs Nordholm wrote: Hello. Is there a current "Best Practices" for logging in D? For the actual logging, I know of `std.experimental.logger`. However, the `experimental` has kept me away from it. Is it good, or are there any better

Re: Can't use threads

2019-05-04 Thread Andre Pany via Digitalmars-d-learn
On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote: Hello, i'm trying to run 3 threads with the following code : https://run.dlang.io/is/p4ThlD It works on run.dlang.io but not on my windows 10 : core.thread.ThreadError@src\core\thread.d(3078): Unable to load thread context If I lower

Re: Can't use threads

2019-05-05 Thread Andre Pany via Digitalmars-d-learn
On Sunday, 5 May 2019 at 12:28:34 UTC, Aldo wrote: On Sunday, 5 May 2019 at 03:32:37 UTC, Andre Pany wrote: On Saturday, 4 May 2019 at 22:29:26 UTC, Aldo wrote: Does it work on windows if you compile it it as 64 bit application (-m64 argument if I remember correctly, dub argument -a x86_64)?

Re: Meson build system user new to D.

2019-05-08 Thread Andre Pany via Digitalmars-d-learn
On Monday, 6 May 2019 at 19:52:23 UTC, Mike Brockus wrote: Hello everyone I am a Meson build system user and I am new to the D language, just wondering if there are compiler flags that I should add, unit testing frameworks, any good practices I can follow and or anything like that also some

Question regarding readf

2019-04-22 Thread Andre Pany via Digitalmars-d-learn
Hi, following the example from http://ddili.org/ders/d.en/input.html, I try to read a value from console on windows (powershell and dos console). The code from the example does not work, writeln is never executed. import std; void main() { while(true) {

Re: Question regarding readf

2019-04-22 Thread Andre Pany via Digitalmars-d-learn
On Monday, 22 April 2019 at 22:08:33 UTC, Ali Çehreli wrote: On 04/22/2019 01:45 PM, Andre Pany wrote: Hi, following the example from http://ddili.org/ders/d.en/input.html, I try to read a value from console on windows (powershell and dos console). The code from the example does not work,

<    1   2   3   4   5   >