How check if destructor has been called?

2022-09-13 Thread Injeckt via Digitalmars-d-learn
Hi, I'm trying to check if destructor has been called, but when I'm deleting class object I didn't get any calls from destructor. myclass.d ~this() { this.log("\nDestructor\n"); this._free_trash(); } main.d try { server.server_init(server); } catch

Re: Why I get delegate when passing address of function?

2022-09-11 Thread Injeckt via Digitalmars-d-learn
On Sunday, 11 September 2022 at 16:26:10 UTC, Ali Çehreli wrote: On 9/11/22 02:54, Injeckt wrote: > [...] You can combine your class object with other arguments and your thread function will know how to unwrap your class object to call its member function: [...] Thank you for help,

Re: Why I get delegate when passing address of function?

2022-09-11 Thread Injeckt via Digitalmars-d-learn
On Sunday, 11 September 2022 at 09:29:23 UTC, Mike Parker wrote: On Sunday, 11 September 2022 at 09:15:11 UTC, Mike Parker wrote: Pointers to non-static member functions always produce a delegate. Otherwise, you wouldn't be able to access the class instance's members. Reference:

Why I get delegate when passing address of function?

2022-09-11 Thread Injeckt via Digitalmars-d-learn
I have a one class and two modificators, where in "public" function I'm calling CreateThread with address of the ClientThread function which stored in same class, but in "private" modificator. And i get this error: Error: cannot pass argument `` of type `extern (Windows) uint delegate(void*

Re: import `Class` is used as a type

2022-09-10 Thread Injeckt via Digitalmars-d-learn
On Saturday, 10 September 2022 at 17:20:29 UTC, H. S. Teoh wrote: On Sat, Sep 10, 2022 at 04:59:50PM +, Injeckt via Digitalmars-d-learn wrote: I'm trying use classes in my project, but when i'm try inherit class, I get error: Error: import `Server.Console` is used as a type

import `Class` is used as a type

2022-09-10 Thread Injeckt via Digitalmars-d-learn
I'm trying use classes in my project, but when i'm try inherit class, I get error: Error: import `Server.Console` is used as a type Server.d: module Server; import std.string; import core.sys.windows.windows; import Console; class Server :

Re: How I can pass the WndProc as a parameter?

2022-09-10 Thread Injeckt via Digitalmars-d-learn
On Saturday, 10 September 2022 at 10:39:12 UTC, Injeckt wrote: utils.d(52): Error: cannot implicitly convert expression `*WndProc` of type `nothrow @system extern (Windows) int(void*, uint, uint, int)` to `extern (Windows) int function(void*, uint, uint, int) nothrow @system`

How I can pass the WndProc as a parameter?

2022-09-10 Thread Injeckt via Digitalmars-d-learn
I define this function: extern(Windows) static LRESULT WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) nothrow { return 0; } Then I define in another .d file: void KK_CreateWindowClass(WNDPROC WndProc) { WNDCLASSEX wndclass;

How to add struct definition?

2022-09-08 Thread Injeckt via Digitalmars-d-learn
I need to add this struct definition in my project. But how to do that? This structure: https://docs.microsoft.com/en-us/windows/win32/api/iptypes/ns-iptypes-ip_adapter_info

Re: How include header file?

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 23:01:34 UTC, Mike Parker wrote: On Wednesday, 7 September 2022 at 20:23:03 UTC, Injeckt wrote: Convert it to D: extern(C) const(char)* inet_ntop(int af, const(void)* src, char* dst, socklen_t size); Win32 API functions need to be `extern(Windows)`.

Re: How include header file?

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 22:57:53 UTC, Loara wrote: On Wednesday, 7 September 2022 at 20:23:03 UTC, Injeckt wrote: On Wednesday, 7 September 2022 at 19:38:52 UTC, H. S. Teoh wrote: On Wed, Sep 07, 2022 at 06:11:14PM +, Injeckt via Digitalmars-d-learn wrote: You need to link

Re: How include header file?

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 20:23:03 UTC, Injeckt wrote: _inet_ntop". I guess I can add my utils.c to my .d project when I compile project and I need write in this file function wrapper of inet_ntop. No, it doesn't work. Jesus I need to figure out how to add WS2tcpip.h

Re: How include header file?

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 19:38:52 UTC, H. S. Teoh wrote: On Wed, Sep 07, 2022 at 06:11:14PM +, Injeckt via Digitalmars-d-learn wrote: I need to include this Ws2tcpip.h header file to my project. How can I do this? It's all because I need inet_ntop function from this header file

How include header file?

2022-09-07 Thread Injeckt via Digitalmars-d-learn
I need to include this Ws2tcpip.h header file to my project. How can I do this? It's all because I need inet_ntop function from this header file.

Re: Reference to an unresolved external symbol

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 10:50:17 UTC, Dennis wrote: On Wednesday, 7 September 2022 at 10:14:22 UTC, Injeckt wrote: I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d". Another way is to add this to your code: ```D pragma(lib, "User32"); ``` Oh

Re: Reference to an unresolved external symbol

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 10:31:02 UTC, rikki cattermole wrote: On 07/09/2022 10:14 PM, Injeckt wrote: On Wednesday, 7 September 2022 at 10:01:11 UTC, rikki cattermole wrote: You have probably forgotten to link against user32. I guess you right. But I don't know how i gonna link

Re: Reference to an unresolved external symbol

2022-09-07 Thread Injeckt via Digitalmars-d-learn
On Wednesday, 7 September 2022 at 10:01:11 UTC, rikki cattermole wrote: You have probably forgotten to link against user32. I guess you right. But I don't know how i gonna link libs when I'm using "dmd main.d". Tell me please.

Reference to an unresolved external symbol

2022-09-07 Thread Injeckt via Digitalmars-d-learn
Hi guys, I have an issue when I compile program with using windows api, I got this message: "reference to an unresolved external symbol _MessageBoxW@16". I just created simple hello world using winapi and MessageBox. import core.runtime; import std.stdio; import std.string;