Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread Timoses via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:27:03 UTC, NewUser wrote: Hi Timoses, The structure is being returned from c and I'd like use it from d. What you have work perfectly when assigning from d. Regards, NewUser Then you probably need some `extern(C)` statement introducing the C function and the

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn
On Friday, 4 May 2018 at 15:16:23 UTC, wjoe wrote: On Friday, 4 May 2018 at 14:24:36 UTC, Vino wrote: On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote: On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn wrote: [...] Linux does not keep track of the creation time of a

Re: Ambiguous template parameter names

2018-05-04 Thread jmh530 via Digitalmars-d-learn
On Thursday, 3 May 2018 at 13:30:03 UTC, bauss wrote: On Thursday, 3 May 2018 at 02:51:18 UTC, Meta wrote: If you want that, you might be able to do `int val = val` on the inner function, though I'm not sure that'll work. It does not work and will do nothing. Below compiles, but my guess

Re: Store any callable in an array

2018-05-04 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 4 May 2018 at 15:36:29 UTC, wjoe wrote: I have a class that I want to be able to register callbacks and I'd like to be able to register any callable - functions, delegates, lambdas, anything. Is there another way to do it besides converting those toDelegate, which states a bug

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
On Friday, 4 May 2018 at 14:55:18 UTC, Timoses wrote: On Friday, 4 May 2018 at 13:27:03 UTC, NewUser wrote: Hi Timoses, The structure is being returned from c and I'd like use it from d. What you have work perfectly when assigning from d. Regards, NewUser Then you probably need some

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
On Friday, 4 May 2018 at 15:37:28 UTC, ag0aep6g wrote: On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: How can I use the following c structure from d. struct Item { int id; }; struct Group { int i; int item_count; struct Item items[]; }; tried defining items[] as both "Item[]

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread ag0aep6g via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: How can I use the following c structure from d. struct Item { int id; }; struct Group { int i; int item_count; struct Item items[]; }; tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but

Store any callable in an array

2018-05-04 Thread wjoe via Digitalmars-d-learn
I have a class that I want to be able to register callbacks and I'd like to be able to register any callable - functions, delegates, lambdas, anything. Is there another way to do it besides converting those toDelegate, which states a bug with @safe functions? Or better store each type in

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread wjoe via Digitalmars-d-learn
On Friday, 4 May 2018 at 15:30:26 UTC, Vino wrote: On Friday, 4 May 2018 at 15:16:23 UTC, wjoe wrote: [...] Hi Wjoe, Thank you very much, but what i am expecting is something like OS switch, based of OS type switch the funciton eg: If OS is windows use the funciton timeCreated else if

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread wjoe via Digitalmars-d-learn
On Friday, 4 May 2018 at 14:24:36 UTC, Vino wrote: On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote: On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn wrote: On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote: > What are you actually trying to do with it? These

Error: module `hello` is in file 'hello.d' which cannot be read

2018-05-04 Thread Alex via Digitalmars-d-learn
Hi I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical import std.stdio; void main() { writeln("Hello, World!"); } And I try to compile and get C:\D>dmd hello.d Error: module `hello` is in file 'hello.d' which cannot be read import path[0]

Re: Error: module `hello` is in file 'hello.d' which cannot be read

2018-05-04 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, May 04, 2018 at 11:29:12PM +, Alex via Digitalmars-d-learn wrote: > Hi > > I just installed D on my windows 10 and want to try to compile a hello > world. My source is a classical > > import std.stdio; > void main() { > writeln("Hello, World!"); > } > > And I try to compile and get

Re: Store any callable in an array

2018-05-04 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote: If toDelegate isn't (always) @safe, how can you be sure that your wrapper is? If it were @safe, the compiler would accept it. Looking at the code, I believe there are several casts that the compiler can't verify but are used safely.

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Kagamin via Digitalmars-d-learn
If you just want to clean logs, then use modification time on all oses: auto clogClean (string LogDir ) { Array!(Tuple!(string, SysTime)) dFiles; dFiles.insert(dirEntries(LogDir, SpanMode.shallow).filter!(a => a.isFile).map!(a => tuple(a.name, a.timeLastModified))); return dFiles; }

Re: Is HibernateD dead?

2018-05-04 Thread Matthias Klumpp via Digitalmars-d-learn
I've written an email to Vadim, maybe we get a reply on the status of both projects. On Friday, 4 May 2018 at 07:18:09 UTC, bauss wrote: [...] Would it maybe be easier for you to base on ddbc[1] or another existing abstraction layer for database abstraction? Ddbc is pretty neat, and even has

Re: Derelict on Ubuntu with CODE::BLOCKS

2018-05-04 Thread RegeleIONESCU via Digitalmars-d-learn
On Thursday, 3 May 2018 at 19:30:48 UTC, Mike Parker wrote: On Thursday, 3 May 2018 at 18:36:04 UTC, RegeleIONESCU wrote: [...] So your app is compiling and executing. This is a runtime error. The SymbolLoadException means the SDL library was loaded, but a function Derelict expected to

Re: Store any callable in an array

2018-05-04 Thread ag0aep6g via Digitalmars-d-learn
On 05/04/2018 06:33 PM, Neia Neutuladh wrote: auto asDelegate(TFunc)(TFunc func) @trusted {     import std.functional : toDelegate;     return toDelegate(func); } The "@trusted" means that you promise this thing is safe, even if the compiler can't be certain. If toDelegate isn't (always)

Re: Windows to Linux Porting

2018-05-04 Thread Vino via Digitalmars-d-learn
On Friday, 4 May 2018 at 07:43:39 UTC, Russel Winder wrote: On Fri, 2018-05-04 at 03:30 +, Vino via Digitalmars-d-learn wrote: [...] `./nasconfig.txt` perhaps: Linux uses / (as does Windows in fact) for directory separator. [...] Hi Russel, Was able to resolve the issue, the

Re: Windows to Linux Porting

2018-05-04 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-05-04 at 08:47 +, Vino via Digitalmars-d-learn wrote: > […] > Was able to resolve the issue, the issue was the letter "L" in > version (Linux) where is should be version (linux). It would have helped if I had read the code first rather than jumped to a conclusion. :-) --

Re: C++ / const class pointer signature / unable to find correct D syntax

2018-05-04 Thread Uknown via Digitalmars-d-learn
On Friday, 4 May 2018 at 07:49:02 UTC, Robert M. Münch wrote: I have a static C++ and can't make it to get a correct binding for one function: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 const) __ptr64

could someone test support for Asian languages in nanogui port?

2018-05-04 Thread drug via Digitalmars-d-learn
I port nanogui, but besides porting I'd like to improve it using great capabilities of D language provides. One of them is utf support, so I added support for Asian languages to nanogui.TextBox. But I'm not sure I've did it well and so I'd like to ask someone to test it using the following:

Re: Windows to Linux Porting

2018-05-04 Thread Vino via Digitalmars-d-learn
On Friday, 4 May 2018 at 09:25:28 UTC, Russel Winder wrote: On Fri, 2018-05-04 at 08:47 +, Vino via Digitalmars-d-learn wrote: […] Was able to resolve the issue, the issue was the letter "L" in version (Linux) where is should be version (linux). It would have helped if I had read

Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn
Hi All, Request your help, I have a D program written on Windows platform and the program is working as expected, now i am trying to port the same program to Linux, my program use the function "timeCreated" from std.file for Windows hugely where as in Linux we do not have the same function

Re: How do you connect Python with D via socket, I'm still getting connection refused error

2018-05-04 Thread Andy Smith via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:58:24 UTC, Enjoys Math wrote: Error - [...] Haven't run it, but two things to try... On D side try adding listen after bind. On python side. Don't think you need to call bind the client socket ( this may cause problems). Cheers, A.

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn wrote: > On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote: > > What are you actually trying to do with it? These functions are > > probably the wholly wrong approach. > > Hi Adam, > > The existing program in Windows do few

Re: LDC phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

2018-05-04 Thread Johan Engelen via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:47:40 UTC, IntegratedDimensions wrote: trying to compile a simple program in x86. Compiles fine in dmd and ldcx64. Seems like ldc is using the wrong lib for some reason? phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine type 'x64' conflicts with

Re: Windows to Linux Porting

2018-05-04 Thread Russel Winder via Digitalmars-d-learn
On Fri, 2018-05-04 at 03:30 +, Vino via Digitalmars-d-learn wrote: > Hi All, > >Request you help on the below code, the below code always state > the file does not exist even if the file do exist. > > Code: > > import core.stdc.stdlib: exit; > import std.stdio; > import std.file; >

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Adam D. Ruppe via Digitalmars-d-learn
What are you actually trying to do with it? These functions are probably the wholly wrong approach.

using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
Hi, How can I use the following c structure from d. struct Item { int id; }; struct Group { int i; int item_count; struct Item items[]; }; tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but gives an error when trying to access it. Here is

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn
On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote: What are you actually trying to do with it? These functions are probably the wholly wrong approach. Hi Adam, The existing program in Windows do few task's eg: Delete files older that certain days, and now we are trying to port to

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread Simen Kjærås via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: How can I use the following c structure from d. struct Item { int id; }; struct Group { int i; int item_count; struct Item items[]; }; tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread NewUser via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:21:53 UTC, Timoses wrote: On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but gives an error when trying to access it. You were on the right track. D array notation is:

Re: Windows to Linux Porting

2018-05-04 Thread Jonathan M Davis via Digitalmars-d-learn
On Friday, May 04, 2018 10:25:28 Russel Winder via Digitalmars-d-learn wrote: > On Fri, 2018-05-04 at 08:47 +, Vino via Digitalmars-d-learn wrote: > > […] > > > Was able to resolve the issue, the issue was the letter "L" in > > > > version (Linux) where is should be version (linux). > > It

Re: using Unsized Arrays in Structures from d?

2018-05-04 Thread Timoses via Digitalmars-d-learn
On Friday, 4 May 2018 at 13:02:08 UTC, NewUser wrote: tried defining items[] as both "Item[] items" and "Item* items" in d, it compiles okay but gives an error when trying to access it. You were on the right track. D array notation is: [] ; For me this works: ``` struct Item { int id; };

Re: Coding Challenges at Dconf2018: Implement Needleman–Wunsch and Smith–Waterman algorithms

2018-05-04 Thread Luís Marques via Digitalmars-d-learn
On Monday, 30 April 2018 at 18:47:21 UTC, biocyberman wrote: I am attending Dconf 2018 and giving a talk there on May 4. Link: https://dconf.org/2018/talks/le.html. It will be very interesting to talk about the outcome of the following challenges. If we can't have at least 3 solutions by three

Re: Windows to Linux Porting - timeCreated and timeLastAccessed

2018-05-04 Thread Vino via Digitalmars-d-learn
On Friday, 4 May 2018 at 14:02:24 UTC, Jonathan M Davis wrote: On Friday, May 04, 2018 13:17:36 Vino via Digitalmars-d-learn wrote: On Friday, 4 May 2018 at 12:38:07 UTC, Adam D. Ruppe wrote: > What are you actually trying to do with it? These functions > are probably the wholly wrong

Re: Coding Challenges at Dconf2018: Implement Needleman–Wunsch and Smith–Waterman algorithms

2018-05-04 Thread biocyberman via Digitalmars-d-learn
On Friday, 4 May 2018 at 14:13:19 UTC, Luís Marques wrote: On Monday, 30 April 2018 at 18:47:21 UTC, biocyberman wrote: I am attending Dconf 2018 and giving a talk there on May 4. Link: https://dconf.org/2018/talks/le.html. It will be very interesting to talk about the outcome of the following

Re: C++ / Wrong function signature generated for reference parameter

2018-05-04 Thread Timoses via Digitalmars-d-learn
On Thursday, 3 May 2018 at 11:29:59 UTC, Robert M. Münch wrote: Not sure I understand this too. This is now what I get: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 const) __ptr64 LIB: public: unsigned int

Re: LDC phobos2-ldc.lib(json.obj) : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'

2018-05-04 Thread kinke via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:47:40 UTC, IntegratedDimensions wrote: Maybe this is a cross compilation issue? Looks like you simply didn't download the LDC multilib package.

Re: Is HibernateD dead?

2018-05-04 Thread bauss via Digitalmars-d-learn
On Thursday, 3 May 2018 at 23:05:02 UTC, Matthias Klumpp wrote: On Thursday, 3 May 2018 at 21:28:18 UTC, bauss wrote: On Thursday, 3 May 2018 at 18:01:07 UTC, Matthias Klumpp wrote: DiamondMVC looks nice, but I would need PostgreSQL support for sure. Therefore, I think there are three

C++ / const class pointer signature / unable to find correct D syntax

2018-05-04 Thread Robert M. Münch via Digitalmars-d-learn
I have a static C++ and can't make it to get a correct binding for one function: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 const) __ptr64 LIB: public: unsigned int __cdecl b2d::Context2D::_begin(class