www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - WinAPI and druntime [was: WinAPI for druntime and OpenGL for deimos]

reply Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
--f46d04016ab711aa6d04cf4c8c2e
Content-Type: text/plain; charset=UTF-8

So I've come to the point where I have the WinAPI modules from
dsource.organd want to add them to druntime.

Here are the issues, that need to be discussed before I can send a pull
request:

1. There is a number of version flags that are expected to be specified to
the compiler, which specifies the Windows version, Internet Explorer
version, winsock version and a bunch of other stuff. I suppose these will
go into the sc.ini under Windows, because those won't change too often and
are equivalent to linking with phobos (not necessary, but provided as a
default).

2. There are some static libraries, which are pragma(lib, ...) -ed inside
those modules, so those libraries will have to be included to the DMD
distribution.

3. They include MinGW copyright and header comments, which I don't know if
can be submitted to druntime as is and if they can be removed either.

4. They contain a special WindowsUnitTests version, which could probably be
replaced with a regular unittests or removed from the DMD distribution.

5. The package to put them is to be decided, because core.sys.windows
contains druntime-specific modules whic hare not to be mixed with WinAPI
modules.

Please leave your comments regarding this.
Maintainers of druntime: is this ok?

-- 
Bye,
Gor Gyolchanyan.

--f46d04016ab711aa6d04cf4c8c2e
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

So I&#39;ve come to the point where I have the WinAPI modules from <a href=
=3D"http://dsource.org">dsource.org</a> and want to add them to druntime.<d=
iv><br></div><div>Here are the issues, that need to be discussed before I c=
an send a pull request:</div>
<div><br></div><div><div style=3D"font-family:arial,sans-serif;font-size:13=
px">1. There is a number of version flags that are expected to be specified=
 to the compiler, which specifies the Windows version, Internet Explorer ve=
rsion, winsock version and a bunch of other stuff. I suppose these will go =
into the sc.ini under Windows, because those won&#39;t change too often and=
 are equivalent to linking with phobos (not necessary, but provided as a de=
fault).<br>
</div><div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div>=
<div style=3D"font-family:arial,sans-serif;font-size:13px">2. There are som=
e static libraries, which are pragma(lib, ...) -ed inside those modules, so=
 those libraries will have to be included to the DMD distribution.</div>
<div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div s=
tyle=3D"font-family:arial,sans-serif;font-size:13px">3. They include MinGW =
copyright and header comments, which I don&#39;t know if can be submitted t=
o druntime as is and if they can be removed either.</div>
<div style=3D"font-family:arial,sans-serif;font-size:13px"><br></div><div s=
tyle=3D"font-family:arial,sans-serif;font-size:13px">4. They contain a spec=
ial WindowsUnitTests version, which could probably be replaced with a regul=
ar unittests or removed from the DMD distribution.</div>
<div><br></div><div>5. The package to put them is to be decided, because co=
re.sys.windows contains druntime-specific modules whic hare not to be mixed=
 with WinAPI modules.</div><div><br></div><div>Please leave your comments r=
egarding this.</div>
<div>Maintainers of druntime: is this ok?</div><div><br></div>-- <br>Bye,<b=
r>Gor Gyolchanyan.<br>
</div>

--f46d04016ab711aa6d04cf4c8c2e--
Nov 24 2012
next sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Sunday, 25 November 2012 at 07:13:15 UTC, Gor Gyolchanyan 
wrote:
 So I've come to the point where I have the WinAPI modules from
 dsource.organd want to add them to druntime.

 Here are the issues, that need to be discussed before I can 
 send a pull
 request:

 1. There is a number of version flags that are expected to be 
 specified to
 the compiler, which specifies the Windows version, Internet 
 Explorer
 version, winsock version and a bunch of other stuff. I suppose 
 these will
 go into the sc.ini under Windows, because those won't change 
 too often and
 are equivalent to linking with phobos (not necessary, but 
 provided as a
 default).

I suggest changing the code to fall back to the minimum version Druntime supports if none of the version flags are specified on the command-line. I believe that would be Windows XP at the moment.
 2. There are some static libraries, which are pragma(lib, ...) 
 -ed inside
 those modules, so those libraries will have to be included to 
 the DMD
 distribution.

Agreed.
 3. They include MinGW copyright and header comments, which I 
 don't know if
 can be submitted to druntime as is and if they can be removed 
 either.

Copyright? Last I checked almost all files, except the WinSock ones, are explicitly specified to be in the public domain. Please clarify?
 4. They contain a special WindowsUnitTests version, which could 
 probably be
 replaced with a regular unittests or removed from the DMD 
 distribution.

There are only two blocks: The first (w32api.d) prints some information regarding the targeted Windows version, I believe. I guess the code could be removed or left as-is. The second (dde.d) seems to tests some struct properties. This can be a normal unittest.
 5. The package to put them is to be decided, because 
 core.sys.windows
 contains druntime-specific modules whic hare not to be mixed 
 with WinAPI
 modules.

I think non-binding code should be moved out of that package. Other OS-specific packages do not seem to contain non-binding code.
Nov 25 2012
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, November 25, 2012 10:38:36 Vladimir Panteleev wrote:
 Copyright? Last I checked almost all files, except the WinSock
 ones, are explicitly specified to be in the public domain. Please
 clarify?

That's certainly what I remember. What's always confused me though is that I've heard that you can't copy from Microsoft's headers because of the copyright on them, but I have no idea where on earth anyone could ever have gotten any Windows headers except from Microsoft. But given that I've heard it disputed that you can even truly copyright headers in the first place (since they're essentially an API rather than an implementation), I really don't know what the legal situation with all of this is. However, many of the mingw headers definitely are definitely in the public domain from what I recall. - Jonathan M Davis
Nov 25 2012
prev sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Sunday, 25 November 2012 at 12:28:11 UTC, Jonathan M Davis 
wrote:
 On Sunday, November 25, 2012 10:38:36 Vladimir Panteleev wrote:
 Copyright? Last I checked almost all files, except the WinSock
 ones, are explicitly specified to be in the public domain. 
 Please
 clarify?

That's certainly what I remember. What's always confused me though is that I've heard that you can't copy from Microsoft's headers because of the copyright on them, but I have no idea where on earth anyone could ever have gotten any Windows headers except from Microsoft. But given that I've heard it disputed that you can even truly copyright headers in the first place (since they're essentially an API rather than an implementation), I really don't know what the legal situation with all of this is. However, many of the mingw headers definitely are definitely in the public domain from what I recall.

You might be able to recreate the headers using: 1) Documentation 2) Programs which print the values of various defines 3) Reimplementation, for macros (e.g. MAKE_HRESULT). IIRC, this is similar to what Wine guidelines recommend.
Nov 25 2012