Re: win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
On Thursday, 2 November 2023 at 17:38:33 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: [...] I put it on dub now so you can just do "dub add dfl". In Entice designer you can then change your compile command to cd.. && dub (if you're in the source

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread H. S. Teoh via Digitalmars-d-learn
On Fri, Nov 03, 2023 at 12:19:48AM +, Andrey Zherikov via Digitalmars-d-learn wrote: > On Thursday, 2 November 2023 at 19:43:01 UTC, Adam D Ruppe wrote: > > On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: > > > The entire reason that it was added to the language was to

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Andrey Zherikov via Digitalmars-d-learn
On Thursday, 2 November 2023 at 19:43:01 UTC, Adam D Ruppe wrote: On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: The entire reason that it was added to the language was to be able to split up existing modules without breaking code. And it does that well. No, it doesn't

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Sergey via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file while the port originally took about 48 minutes. In my experience I/O in D is quite slow. But you can try to improve it:

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 2 November 2023 at 19:30:58 UTC, Jonathan M Davis wrote: The entire reason that it was added to the language was to be able to split up existing modules without breaking code. And it does that well. No, it doesn't do that well at all. In fact, it does that so extremely poorly

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 2, 2023 7:04:37 AM MDT Adam D Ruppe via Digitalmars-d- learn wrote: > On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: > > Therefore the need to import `package.d` is needed and I can't > > see a solution, which means > > tbh package.d should never be used. It is a

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: Therefore the need to import `package.d` is needed and I can't see a solution, which means that D Language might have to introduce a way to import `package.d` from inside the package, if there is a need to further improve experience

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 13:40:14 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 12:47:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:43:01 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I tried std.io but write() only outputs ubyte[] while I'm trying to output text so I abandoned idea early. Just specifically to answer this, this is so you understand this is what is going into the file -- bytes. You should

Re: What are the best available D (not C) File input/output options?

2023-11-02 Thread Julian Fondren via Digitalmars-d-learn
On Thursday, 2 November 2023 at 15:46:23 UTC, confuzzled wrote: I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file while the port originally took about 48 minutes. My naïve attempt to improve the situation pushed it over an hour and 15

Re: Function Overloading

2023-11-02 Thread Basile B. via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:17:42 UTC, Salih Dincer wrote: On Wednesday, 1 November 2023 at 20:04:52 UTC, Basile B. wrote: Yes. D constructors are not named but the current implementation adds a name that is `__ctor`, so add ```d alias add = __ctor; ``` to you struct. Yeah, it

What are the best available D (not C) File input/output options?

2023-11-02 Thread confuzzled via Digitalmars-d-learn
I've ported a small script from C to D. The original C version takes roughly 6.5 minutes to parse a 12G file while the port originally took about 48 minutes. My naïve attempt to improve the situation pushed it over an hour and 15 minutes. However, replacing std.stdio:File with

Re: win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:47:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:43:01 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51 UTC, Imperatorn wrote: [...] Yes,exactly. That was developed

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 14:15, Arafel wrote: You simply can't expect to do `import waffle.foo` from within `waffle/` itself (unless you have another `waffle` folder in it, which is often the case). Sorry, this is wrong. It should read: You simply can't expect to do `import waffle.foo` **when invoking

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 13:52, BoQsc wrote: Well the whole thread is about importing `package.d` while being inside package to provide runnable working example which contains debug information of the package. Sorry, but I have never seen a package that includes examples within the package directory

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:52:35 UTC, BoQsc wrote: Therefore the need to import `package.d` is needed and I can't see a solution, which means tbh package.d should never be used. It is a poorly designed, buggy misfeature of the language with plenty of better working alternatives (it

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
Well the whole thread is about importing `package.d` while being inside package to provide runnable working example which contains debug information of the package. Sidenote: This is essentially useful when distributing over many machines/platforms via `dub` package manager. You would want

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:43:01 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51 UTC, Imperatorn wrote: [...] Yes,exactly. That was developed with D+iupD. Under windows,I use PoseidonD with Entice

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:22:29 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:58:51 UTC, Imperatorn wrote: [...] Yes,exactly. That was developed with D+iupD. Under windows,I use PoseidonD with Entice Designer+DFL: Entice Designer: http://www.dprogramming.com/entice.php DFL

Re: win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
On Thursday, 2 November 2023 at 12:01:18 UTC, ryuukk_ wrote: On Thursday, 2 November 2023 at 10:17:37 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:02:29 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: [...] I'm not sure why, it works for me,

Re: win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:58:51 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 10:17:37 UTC, Peter Hu wrote: [...] I'm sorry, I don't know. I have just observed that when using LDC the libraries gets forwarded from submodules but not with DMD. So what I usually do is to

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 12:57, BoQsc wrote: The current major problem is that it does not work on Windows operating system with either `rdmd` or `dmd`. While it does work on run.dlang.io. The problem is with your import path. If you say: ```d import waffles; ``` The compiler would search for either

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: Weirdly enough it does not work on Windows operating system. [...] ``` program.d(1): Error: unable to read module `waffles` program.d(1):Expected 'waffles.d' or 'waffles\package.d' in one of the following import paths: import

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:57:57 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 11:32:40 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: [...] ```d ---

Re: win32 api & lib issue

2023-11-02 Thread ryuukk_ via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:17:37 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:02:29 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:32:40 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io

Re: bigEndian in std.bitmanip

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:29:05 UTC, Salih Dincer wrote: On Tuesday, 31 October 2023 at 14:43:43 UTC, Imperatorn wrote: It might make sense to change since little endian is the most common when it comes to hardware. But big endian is most common when it comes to networking. So I guess

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 11:12:58 UTC, BoQsc wrote: On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link:

Re: bigEndian in std.bitmanip

2023-11-02 Thread Salih Dincer via Digitalmars-d-learn
On Tuesday, 31 October 2023 at 14:43:43 UTC, Imperatorn wrote: It might make sense to change since little endian is the most common when it comes to hardware. But big endian is most common when it comes to networking. So I guess it depends on your view of what is most common. Interacting with

Re: Function Overloading

2023-11-02 Thread Salih Dincer via Digitalmars-d-learn
On Wednesday, 1 November 2023 at 20:04:52 UTC, Basile B. wrote: Yes. D constructors are not named but the current implementation adds a name that is `__ctor`, so add ```d alias add = __ctor; ``` to you struct. Yeah, it works! Thanks...:) SDB@79

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:53:12 UTC, Arafel wrote: On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Zbrn75 ``` --- waffles/program.d import waffles; ``` See

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:17:37 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 10:02:29 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread Arafel via Digitalmars-d-learn
On 02.11.23 11:45, BoQsc wrote: Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Zbrn75 ``` --- waffles/program.d import waffles; ``` See https://dlang.org/spec/module.html#package-module

Re: Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
Edit incorrect link to example: [Extensive run.dlang.io example](https://run.dlang.io/is/f3jURn) Correct link: https://run.dlang.io/is/Zbrn75

Keyword "package" prevents from importing a package module "package.d"

2023-11-02 Thread BoQsc via Digitalmars-d-learn
![](https://i.imgur.com/829CzOS.png) Source File **package.d** is a [package module][1] which contains import statements to import other modules. How would one import a **package.d** module when [**keyword "package"**][2] is preventing that? [1]:

Re: win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
On Thursday, 2 November 2023 at 10:02:29 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:58:21 UTC, Peter Hu wrote: On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I

Re: win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:13:11 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:08:02 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : [...] If it still doesn't work try adding

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : [...] If it still doesn't work try adding this: ```d pragma(lib, "user32"); pragma(lib, "comdlg32"); ```

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 09:01:06 UTC, Imperatorn wrote: On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: [...] Works for me. This is all you need ```d import core.sys.windows.commdlg; import core.sys.windows.winuser; void main() { wchar[256] fileName;

Re: win32 api & lib issue

2023-11-02 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 2 November 2023 at 08:31:41 UTC, Peter Hu wrote: Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : import core.sys.windows.windows; import core.sys.windows.commdlg; import core.sys.windows.winuser;

win32 api & lib issue

2023-11-02 Thread Peter Hu via Digitalmars-d-learn
Greetings! From time to time I encountered issues on the subjected after I upgraded my dmd package.Given below code : import core.sys.windows.windows; import core.sys.windows.commdlg; import core.sys.windows.winuser; extern(Windows) BOOL GetOpenFileNameW(LPOPENFILENAMEW); extern(Windows) int