Thread overview
I don't understand why dependencies are not imported.
Mar 08
Enamisu
Mar 09
Enamisu
Mar 09
Enamisu
March 08

I have errors when working with the core.sys.windows.winnt library. I use dub to compile the program. I don't understand why dependencies are not imported. Please help me understand the cause of the error.

    enamisu@pc:~/Project$ dub build
    Starting Performing "debug" build using /usr/bin/dmd for x86_64.
    Building secured 1.0.0: building configuration [library]
    Building protectmyd ~master: building configuration [app]
source/app.d(15,15): Error: undefined identifier `DWORD` in module `core.sys.windows.windef`
source/app.d(16,18): Error: undefined identifier `MAX_PATH` in module `core.sys.windows.windows`
source/app.d(17,16): Error: undefined identifier `HANDLE` in module `core.sys.windows.windef`
source/app.d(18,15): Error: undefined identifier `PVOID` in module `core.sys.windows.windef`
source/app.d(19,14): Error: undefined identifier `BOOL` in module `core.sys.windows.windef`
source/app.d(20,18): Error: undefined identifier `PCONTEXT` in module `core.sys.windows.winnt`
source/app.d(21,16): Error: undefined identifier `LPVOID` in module `core.sys.windows.windef`
source/app.d(22,16): Error: undefined identifier `SIZE_T` in module `core.sys.windows.basetsd`
source/common/run.d(15,15): Error: undefined identifier `DWORD` in module `core.sys.windows.windef`
source/common/run.d(16,14): Error: undefined identifier `LONG` in module `core.sys.windows.windef`
source/common/run.d(17,16): Error: undefined identifier `HANDLE` in module `core.sys.windows.windef`
source/common/run.d(18,15): Error: undefined identifier `PVOID` in module `core.sys.windows.windef`
source/common/run.d(19,14): Error: undefined identifier `BOOL` in module `core.sys.windows.windef`
source/common/run.d(20,18): Error: undefined identifier `PCONTEXT` in module `core.sys.windows.winnt`
source/common/run.d(21,16): Error: undefined identifier `LPVOID` in module `core.sys.windows.windef`
source/common/run.d(22,16): Error: undefined identifier `SIZE_T` in module `core.sys.windows.basetsd`
source/common/run.d(23,17): Error: undefined identifier `LPCVOID` in module `core.sys```

import std.stdio;
import std.file;
import std.string;
import std.conv;
import std.algorithm;
import std.exception;
import core.sys.windows.windows;
import core.sys.windows.winnt;
import core.sys.windows.windef;
import core.sys.windows.winbase;
import core.sys.windows.basetsd;
import secured.aes;```

March 09

On Saturday, 8 March 2025 at 22:21:45 UTC, Enamisu wrote:

>

I have errors when working with the core.sys.windows.winnt library. I use dub to compile the program. I don't understand why dependencies are not imported. Please help me understand the cause of the error.

It looks like the errors are being caused by some code in source/app.d and source/common/run.d. Can you post the contents of these files?

March 09

On Sunday, 9 March 2025 at 02:21:09 UTC, Paul Backus wrote:

>

On Saturday, 8 March 2025 at 22:21:45 UTC, Enamisu wrote:

>

I have errors when working with the core.sys.windows.winnt library. I use dub to compile the program. I don't understand why dependencies are not imported. Please help me understand the cause of the error.

It looks like the errors are being caused by some code in source/app.d and source/common/run.d. Can you post the contents of these files?

app.d

import std.stdio;
import std.file;
import std.string;
import std.conv;
import std.algorithm;
import std.exception;
import core.sys.windows.windows;
import core.sys.windows.winnt;
import core.sys.windows.windef;
import core.sys.windows.winbase;
import core.sys.windows.basetsd;
import secured.aes;

// Explicitly import necessary types
alias DWORD = core.sys.windows.windef.DWORD;
alias MAX_PATH = core.sys.windows.windows.MAX_PATH;
alias HANDLE = core.sys.windows.windef.HANDLE;
alias PVOID = core.sys.windows.windef.PVOID;
alias BOOL = core.sys.windows.windef.BOOL;
alias PCONTEXT = core.sys.windows.winnt.PCONTEXT;
alias LPVOID = core.sys.windows.windef.LPVOID;
alias SIZE_T = core.sys.windows.basetsd.SIZE_T;

// Global Variables
char[] fileBuffer; // Buffer to store the file's data
DWORD fileSize; // Stores the file size
char[MAX_PATH] outputFileName; // Stores the output file name
char encryptionChoice; // Stores the user's choice of encryption method
DWORD bytesWritten = 0; // Stores the number of bytes written
char[MAX_PATH] inputFileName; // Stores the name of the file to be encrypted
ubyte[] fileData; // Stores the file data to be encrypted

run.d

import core.sys.windows.windows;
import core.sys.windows.tlhelp32;
import core.sys.windows.winnt;
import core.sys.windows.windef;
import core.sys.windows.basetsd;
import core.sys.windows.wingdi;
import core.sys.windows.winsock2;
import core.sys.windows.winsvc;
import core.sys.windows.winuser;
import core.stdc.wchar_;
import std.exception;
import std.stdio;

// Explicitly import necessary types
alias DWORD = core.sys.windows.windef.DWORD;
alias LONG = core.sys.windows.windef.LONG;
alias HANDLE = core.sys.windows.windef.HANDLE;
alias PVOID = core.sys.windows.windef.PVOID;
alias BOOL = core.sys.windows.windef.BOOL;
alias PCONTEXT = core.sys.windows.winnt.PCONTEXT;
alias LPVOID = core.sys.windows.windef.LPVOID;
alias SIZE_T = core.sys.windows.basetsd.SIZE_T;
alias LPCVOID = core.sys.windows.windef.LPCVOID;
alias LPPROCESSENTRY32 = core.sys.windows.tlhelp32.LPPROCESSENTRY32;

I probably don't understand something, but I even looked at the source code of the library.

March 09

On Saturday, 8 March 2025 at 22:21:45 UTC, Enamisu wrote:

>

I have errors when working with the core.sys.windows.winnt library. I use dub to compile the program. I don't understand why dependencies are not imported. Please help me understand the cause of the error.

    enamisu@pc:~/Project$ dub build
    Starting Performing "debug" build using /usr/bin/dmd for x86_64.

This is the problem: /usr/bin/dmd

It suggests you're not on Windows. All of the Windows-specific declarations are available only when version(Windows) is true. You'll need to cross-compile with LDC or build on a Windows box.

When you do, import core.sys.windows.windows should be the only import you need. And you can get rid of all of your aliases.

March 09

On Sunday, 9 March 2025 at 08:25:00 UTC, Mike Parker wrote:

>

On Saturday, 8 March 2025 at 22:21:45 UTC, Enamisu wrote:

>

I have errors when working with the core.sys.windows.winnt library. I use dub to compile the program. I don't understand why dependencies are not imported. Please help me understand the cause of the error.

    enamisu@pc:~/Project$ dub build
    Starting Performing "debug" build using /usr/bin/dmd for x86_64.

This is the problem: /usr/bin/dmd

It suggests you're not on Windows. All of the Windows-specific declarations are available only when version(Windows) is true. You'll need to cross-compile with LDC or build on a Windows box.

When you do, import core.sys.windows.windows should be the only import you need. And you can get rid of all of your aliases.

Thank you very much, it really works. It's a pity that I'll have to use a Windows virtual machine, it's not convenient.

March 09

On Sunday, 9 March 2025 at 12:01:41 UTC, Enamisu wrote:

>

Thank you very much, it really works. It's a pity that I'll have to use a Windows virtual machine, it's not convenient.

Well, if you're trying to do Windows programming, it's to be expected that you'll either need to be on Windows or cross compile. If you want to try that, there are instructions on the wiki for how to do it with LDC:

https://wiki.dlang.org/Cross-compiling_with_LDC

I don't know if they're up to date.