Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 27, 2013 now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
the error is : Error: undefined identifier RegisterClassExW, did you mean function RegisterClassExA? No I didn't mean that. So how to import winapi functions ? |
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsk82 | Am 27.01.2013 18:45, schrieb rsk82:
> the error is :
>
> Error: undefined identifier RegisterClassExW, did you mean function
> RegisterClassExA?
>
> No I didn't mean that.
>
> So how to import winapi functions ?
extern(Windows) <insert function definition here>
|
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On Sunday, 27 January 2013 at 17:51:40 UTC, Benjamin Thaut wrote: > extern(Windows) <insert function definition here> I am not sure what I was supposed to do, so I did this: extern(Windows) ATOM RegisterClassExW(const WNDCLASSEXW *lpwcx); ATOM class_atom = RegisterClassExW(&wc); and got linker error: OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Error 42: Symbol Undefined __D4test8doWindow6__ctorMFZC4test8doWindow16RegisterClassExWWxPS4test8doWindow6__ctorMFZC4test8doWindow11WNDCLASSEXWZt@4 --- errorlevel 1 |
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsk82 | Am 27.01.2013 19:01, schrieb rsk82:
> On Sunday, 27 January 2013 at 17:51:40 UTC, Benjamin Thaut wrote:
>> extern(Windows) <insert function definition here>
>
> I am not sure what I was supposed to do, so I did this:
>
> extern(Windows) ATOM RegisterClassExW(const WNDCLASSEXW *lpwcx);
> ATOM class_atom = RegisterClassExW(&wc);
>
> and got linker error:
>
> OPTLINK (R) for Win32 Release 8.00.12
> Copyright (C) Digital Mars 1989-2010 All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> test.obj(test)
> Error 42: Symbol Undefined
> __D4test8doWindow6__ctorMFZC4test8doWindow16RegisterClassExWWxPS4test8doWindow6__ctorMFZC4test8doWindow11WNDCLASSEXWZt@4
>
> --- errorlevel 1
Did you link against User32.lib?
I also recommend that you use VisualD it will give you "pretty" linker error messages.
Kind Regards
Ingrater
|
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsk82 | On Sunday, 27 January 2013 at 18:01:38 UTC, rsk82 wrote: > On Sunday, 27 January 2013 at 17:51:40 UTC, Benjamin Thaut wrote: >> extern(Windows) <insert function definition here> > > I am not sure what I was supposed to do, so I did this: > > extern(Windows) ATOM RegisterClassExW(const WNDCLASSEXW *lpwcx); This must be declared at module level (not inside a function). > ATOM class_atom = RegisterClassExW(&wc); > > and got linker error: > > OPTLINK (R) for Win32 Release 8.00.12 > Copyright (C) Digital Mars 1989-2010 All rights reserved. > http://www.digitalmars.com/ctg/optlink.html > test.obj(test) > Error 42: Symbol Undefined __D4test8doWindow6__ctorMFZC4test8doWindow16RegisterClassExWWxPS4test8doWindow6__ctorMFZC4test8doWindow11WNDCLASSEXWZt@4 > --- errorlevel 1 |
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Chapman | On Sunday, 27 January 2013 at 18:26:04 UTC, John Chapman wrote:
> This must be declared at module level (not inside a function).
Ok, I've put it into module, linked in the module
pragma(lib, "user32.lib");
and
pragma(lib, "gdi32.lib");
all this works until I put
extern(Windows) ATOM RegisterClassExW(const WNDCLASSEXW *lpwcx);
on line 30, then I get as if this was a code not a new function import:
.\mod\myModule.d(30): Error: undefined identifier WNDCLASSEXW, did you mean struct WNDCLASSEXA?
|
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Benjamin Thaut | On Sunday, 27 January 2013 at 17:51:40 UTC, Benjamin Thaut wrote:
> extern(Windows) <insert function definition here>
I don't know If that what you meant but this works *inside* the code:
extern(Windows)
ATOM class_atom = RegisterClassExW(&wc);
|
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsk82 | On Sunday, 27 January 2013 at 18:58:59 UTC, rsk82 wrote:
> On Sunday, 27 January 2013 at 18:26:04 UTC, John Chapman wrote:
>> This must be declared at module level (not inside a function).
>
> Ok, I've put it into module, linked in the module
> pragma(lib, "user32.lib");
> and
> pragma(lib, "gdi32.lib");
>
> all this works until I put
>
> extern(Windows) ATOM RegisterClassExW(const WNDCLASSEXW *lpwcx);
>
> on line 30, then I get as if this was a code not a new function import:
>
> .\mod\myModule.d(30): Error: undefined identifier WNDCLASSEXW, did you mean struct WNDCLASSEXA?
Because WNDCLASSEXW is not defined. So define it above RegisterClassExW.
struct WNDCLASSEXW {
UINT cbSize = WNDCLASSEXW.sizeof;
UINT style;
WNDPROC lpfnWndProc;
int cbClsExtra;
int cbWndExtra;
HINSTANCE hInstance;
HICON hIcon;
HCURSOR hCursor;
HBRUSH hbrBackground;
LPCTSTR lpszMenuName;
LPCTSTR lpszClassName;
HICON hIconSm;
}
|
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rsk82 | On Sunday, 27 January 2013 at 19:25:28 UTC, rsk82 wrote:
> extern(Windows)
> ATOM class_atom = RegisterClassExW(&wc);
No, I'm wrong, now the compiler ignores the class that I put in my module, I can write every nonsense that comes to my mind and it compiles. But if I put extern outside of the class then it shows error.
|
January 27, 2013 Re: now I didn't have RegisterClassExW, how to import that ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to John Chapman | On Sunday, 27 January 2013 at 19:29:03 UTC, John Chapman wrote:
> On Sunday, 27 January 2013 at 18:58:59 UTC, rsk82 wrote:
>> On Sunday, 27 January 2013 at 18:26:04 UTC, John Chapman wrote:
>>> This must be declared at module level (not inside a function).
>>
>> Ok, I've put it into module, linked in the module
>> pragma(lib, "user32.lib");
>> and
>> pragma(lib, "gdi32.lib");
>>
>> all this works until I put
>>
>> extern(Windows) ATOM RegisterClassExW(const WNDCLASSEXW *lpwcx);
>>
>> on line 30, then I get as if this was a code not a new function import:
>>
>> .\mod\myModule.d(30): Error: undefined identifier WNDCLASSEXW, did you mean struct WNDCLASSEXA?
>
> Because WNDCLASSEXW is not defined. So define it above RegisterClassExW.
>
> struct WNDCLASSEXW {
> UINT cbSize = WNDCLASSEXW.sizeof;
> UINT style;
> WNDPROC lpfnWndProc;
> int cbClsExtra;
> int cbWndExtra;
> HINSTANCE hInstance;
> HICON hIcon;
> HCURSOR hCursor;
> HBRUSH hbrBackground;
> LPCTSTR lpszMenuName;
> LPCTSTR lpszClassName;
> HICON hIconSm;
> }
Actually, replace "LPCTSTR" above with "LPCWSTR".
|
Copyright © 1999-2021 by the D Language Foundation