I don't understand why dependencies are not imported.
Enamisu
norukaenamisu at gmail.com
Sun Mar 9 07:45:29 UTC 2025
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.
More information about the Digitalmars-d-learn
mailing list