View previous topic :: View next topic |
Author |
Message |
Raedwulf
Joined: 21 Jan 2007 Posts: 9
|
Posted: Sun Mar 18, 2007 1:24 am Post subject: Windows API |
|
|
I tried compiling the winsamp.d with the Windows API headers supplied in bindings.
Code: | import win32.windows; |
rather than the phobos:
Code: | import std.c.windows.windows; |
Im sure I must be doing something wrong, because I keep getting a linker error:
Code: | dmd.exe -O -inline -IC:\dmd\projects\irrlichtd\src\lib -IC:\dmd\src\phobos -IC:\dmd\tango -IC:\dmd\dm\lib -IC:\dm\lib -c main.d -ofobj\Release\main.obj
dmd.exe -O -inline -IC:\dmd\projects\irrlichtd\src\lib -IC:\dmd\src\phobos -IC:\dmd\tango -IC:\dmd\dm\lib -IC:\dm\lib -c gc.d -ofobj\Release\gc.obj
dmd.exe bin\Release\jpegread.exe jpegread.def obj\Release\main.obj obj\Release\gc.obj user32.lib kernel32.lib gdi32.lib phobos.lib
C:\dmd\bin\..\..\dm\bin\link.exe obj\Release\main+obj\Release\gc,bin\Release\jpegread.exe,,user32.lib+kernel32.lib+gdi32.lib+phobos.lib+user32+kernel32,jpegread.def/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
obj\Release\main.obj(main)
Error 42: Symbol Undefined _D5win326windef6LOWORDFkZt
obj\Release\main.obj(main)
Error 42: Symbol Undefined _D5win326windef6HIWORDFkZt
obj\Release\main.obj(main)
Error 42: Symbol Undefined _D5win327winuser13CreateWindowAFPaPakiiiiT5win325winnt6HANDLET5win325winnt6HANDLET5win325winnt6HANDLEPvZT5win325winnt6HANDLE
C:\dm\bin\..\lib\SNN.lib(winstart)
Error 42: Symbol Undefined _WinMain@16
--- errorlevel 4 |
Cheers _________________ Raedwulf |
|
Back to top |
|
|
jcc7
Joined: 22 Feb 2004 Posts: 657 Location: Muskogee, OK, USA
|
Posted: Mon Mar 19, 2007 7:08 am Post subject: Re: Windows API |
|
|
Raedwulf wrote: | Code: | dmd.exe bin\Release\jpegread.exe jpegread.def obj\Release\main.obj obj\Release\gc.obj user32.lib kernel32.lib gdi32.lib phobos.lib
C:\dmd\bin\..\..\dm\bin\link.exe obj\Release\main+obj\Release\gc,bin\Release\jpegread.exe,,user32.lib+kernel32.lib+gdi32.lib+phobos.lib+user32+kernel32,jpegread.def/noi;
OPTLINK (R) for Win32 Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001 All Rights Reserved
obj\Release\main.obj(main)
Error 42: Symbol Undefined _D5win326windef6LOWORDFkZt
obj\Release\main.obj(main)
Error 42: Symbol Undefined _D5win326windef6HIWORDFkZt
obj\Release\main.obj(main)
Error 42: Symbol Undefined _D5win327winuser13CreateWindowAFPaPakiiiiT5win325winnt6HANDLET5win325winnt6HANDLET5win325winnt6HANDLEPvZT5win325winnt6HANDLE
C:\dm\bin\..\lib\SNN.lib(winstart)
Error 42: Symbol Undefined _WinMain@16
--- errorlevel 4 |
Cheers | It looks like you might have multiple problems, but one problem seems to be that you need to include windef.d (or windef.obj if you want to compile it in a separate step) in the last call to DMD. Also, winuser.d and/or winnt.d seems to be needed in the same way.
I don't know what's causing the "_WinMain@16" error. |
|
Back to top |
|
|
Raedwulf
Joined: 21 Jan 2007 Posts: 9
|
Posted: Mon Mar 19, 2007 7:16 am Post subject: |
|
|
I think I see what the problem is . I'm using Codeblocks IDE, and it likes to compile each source file separately and only linking the files finally at the end. So i guess I should compile the win32 files into object/lib files?
Cheers. _________________ Raedwulf |
|
Back to top |
|
|
WeirdCat
Joined: 29 Apr 2007 Posts: 19
|
Posted: Fri May 11, 2007 1:35 am Post subject: |
|
|
Raedwulf wrote: | So i guess I should compile the win32 files into object/lib files? |
I've recently added a makefile for this purpose. At the moment (changeset #185) you only have to remove 4 files (iprtrmib1.d, mswsock.d, vfw.d and winsock.d) from the directory for a successfull build.
LLAP,
Sascha |
|
Back to top |
|
|
sleets
Joined: 29 Jun 2007 Posts: 27
|
Posted: Fri Jun 29, 2007 6:57 pm Post subject: |
|
|
i got this with make.
Code: |
Error on line 1: '=' is not a valid filename char
|
|
|
Back to top |
|
|
sleets
Joined: 29 Jun 2007 Posts: 27
|
Posted: Fri Jun 29, 2007 7:02 pm Post subject: |
|
|
my make is
Code: |
Digital Mars Make Version 5.05
Copyright (C) Digital Mars 1985-2004. All Rights Reserved.
Written by Walter Bright www.digitalmars.com
Documentation: www.digitalmars.com/ctg/make.html
MAKE {target} {macro=text} {-dilnqst} [-fmakefile] {@file}
@file Get command args from environment or file
target What targets to make macro=text Define macro to be text
-d Output debugging info -ffile Use file instead of makefile
-f- Read makefile from stdin -i Ignore errors from executing make rules
-l List macro expansions -n Just echo rules that would be executed
-q If rules would be executed -s Do not echo make rules
then exit with errorlevel 1 -t Just touch files
Predefined macros:
$$ Expand to $
$@ Full target name
$? List of dependencies that are newer than target
$** Full list of dependencies
$* Name of current target without extension
$< From name of current target, if made using an implicit rule
Rule flags:
+ Force use of COMMAND.COM to execute rule
- Ignore exit status
@ Do not echo rule
* Can handle environment response files
~ Force use of environment response file
Command error: undefined switch '-h'
|
|
|
Back to top |
|
|
WeirdCat
Joined: 29 Apr 2007 Posts: 19
|
Posted: Fri Jun 29, 2007 11:44 pm Post subject: |
|
|
sleets wrote: | my make is
Code: | Digital Mars Make Version 5.05 |
|
The make tool from Digital Mars is to primitiv, you need a more advanced make like the make from GNU. For Windows you can download it as a part from UnxUtils (Sourceforge link).
LLAP,
Sascha |
|
Back to top |
|
|
sleets
Joined: 29 Jun 2007 Posts: 27
|
Posted: Wed Jul 04, 2007 9:31 pm Post subject: |
|
|
thanks for your help.
I use the GNU Make version 3.79.1 got this.
Code: |
cl@NF /dlang/dmd/import/win32
$ make
dmd.exe d3d9.d -c -inline -I.. -O -release -w -version=Unicode -version=WindowsVista
warning - ..\win32\d3d9types.d(1117): Error: implicit conversion of expression (_Version >> 8 & 255u) of type uint to ubyte can cause loss of data
warning - ..\win32\d3d9types.d(1118): Error: implicit conversion of expression (_Version >> 0 & 255u) of type uint to ubyte can cause loss of data
make: *** [d3d9.obj] Error 1
|
|
|
Back to top |
|
|
WeirdCat
Joined: 29 Apr 2007 Posts: 19
|
Posted: Thu Jul 05, 2007 12:22 am Post subject: |
|
|
sleets wrote: | thanks for your help.
I use the GNU Make version 3.79.1 got this. |
That's only warnings in the file 'd3d9types.d'. I think Clw who commited them recently don't used the compiler switch '-w'. I've just fixed them in revision #192.
LLAP,
Sascha (aka WeirdCat) |
|
Back to top |
|
|
smjg
Joined: 29 Sep 2004 Posts: 41
|
Posted: Mon Aug 27, 2007 5:54 pm Post subject: |
|
|
WeirdCat wrote: | The make tool from Digital Mars is to primitiv, you need a more advanced make like the make from GNU. For Windows you can download it as a part from UnxUtils (Sourceforge link). |
Why can't it be made compatible with either standard make or Digital Mars make? What does the GNU-specific := notation mean anyway? |
|
Back to top |
|
|
WeirdCat
Joined: 29 Apr 2007 Posts: 19
|
Posted: Mon Sep 03, 2007 4:11 am Post subject: |
|
|
smjg wrote: | Why can't it be made compatible with either standard make or Digital Mars make? What does the GNU-specific := notation mean anyway? |
Is there a standard make? I thought GNU make is THE standard.
No realy... it is no problem to make the makefile compatible with more make tools, the problem is that you can't use wildcards then. Therefore you have to maintain a list of every single file in the makefile. I think this is circumstantially in a project with so many contributors. It is much easier to use wildcards.
That doesn't mean we could not have more than one makefile, for different make tools.
LLAP,
Sascha (aka WeirdCat) |
|
Back to top |
|
|
WeirdCat
Joined: 29 Apr 2007 Posts: 19
|
|
Back to top |
|
|
smjg
Joined: 29 Sep 2004 Posts: 41
|
Posted: Sun Oct 28, 2007 8:14 am Post subject: |
|
|
WeirdCat wrote: | No realy... it is no problem to make the makefile compatible with more make tools, the problem is that you can't use wildcards then. |
can be used to generate a list of code files, but is there any way we could use the output from this in the makefile? |
|
Back to top |
|
|
WeirdCat
Joined: 29 Apr 2007 Posts: 19
|
Posted: Sun Oct 28, 2007 8:50 am Post subject: |
|
|
smjg wrote: | can be used to generate a list of code files, but is there any way we could use the output from this in the makefile? |
I see only the way to manually include them with a text editor per copy 'n paste... at least with a makefile. |
|
Back to top |
|
|
bobef
Joined: 05 Jun 2005 Posts: 269
|
Posted: Wed Mar 05, 2008 11:34 am Post subject: Tango |
|
|
I don't know if this is the correct thread, but I see it is about Windows API. I compiled it today with Tango. It requires few minor modifications.
iptypes.d:
Code: | version(Tango) private import tango.stdc.time;
else private import std.c.time; |
winldap.d@453:
Code: | int ldap_perror(LDAP* handle, char* message) {
return 0;//printf("%s: %s\n", message, handle.ld_error);
} |
(or include file with printf)
d3dx10math.d:
Quote: | version(Tango) import tango.stdc.math;
else import std.c.math; |
|
|
Back to top |
|
|
|