digitalmars.D - C compatibility module for phobos.
- Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> Sep 21 2011
- =?ISO-8859-1?Q?Alex_R=F8nne_Petersen?= <xtzgzorex gmail.com> Sep 21 2011
- Gor F. Gyolchanyan <gor.f.gyolchanyan gmail.com> Sep 21 2011
- Jesse Phillips <jessekphillips+D gmail.com> Sep 21 2011
- Gor F. Gyolchanyan <gor.f.gyolchanyan gmail.com> Sep 21 2011
- Gor F. Gyolchanyan <gor.f.gyolchanyan gmail.com> Sep 21 2011
- Jacob Carlborg <doob me.com> Sep 22 2011
- Andrej Mitrovic <andrej.mitrovich gmail.com> Sep 21 2011
--0015174c3f0cefa40404ad6efa68 Content-Type: text/plain; charset=ISO-8859-1 Hello, my dear, beloved D community. I've been reading literally all discussions on D.puremagic.com for about a month now and I'm deeply concerned with my favorite language and it's reference compiler. So, for starters, i decided to add a very useful (in my opinion) module to phobos: etc.c.compat. Here's the pull request: https://github.com/D-Programming-Language/phobos/pull/265 This module is supposed to help people develop bindings for C libraries, by providing information language-specific information, depending on certain compiler, processor architecture, operating system, etc. Currently there are only aliases for C built-in types, which are static if-ed to have the correct size for the respective C compilers. It's well-documented and waits to be enhanced with more accurate compile-time branching and additional useful information to make binding C code even easier. If we get a good enough C compatibility module, we'll be able to rapidly bind all major and frequently-used libraries and include them in phobos. This will also do a great job of promoting D as a good language to adopt for serious projects, because it's standard library will be very rich and common usage won't require the programmer to resort to anything besides phobos. Any comments would be much appreciated. --0015174c3f0cefa40404ad6efa68 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hello, my dear, beloved D community.<br><br>I've been reading literally= all discussions on <a href=3D"http://D.puremagic.com">D.puremagic.com</a> = for about a month now and I'm deeply concerned with my favorite languag= e and it's reference compiler.<br> <br>So, for starters, i decided to add a very useful (in my opinion) module= to phobos: etc.c.compat.<br><br>Here's the pull request: <a href=3D"ht= tps://github.com/D-Programming-Language/phobos/pull/265">https://github.com= /D-Programming-Language/phobos/pull/265</a><br> <br>This module is supposed to help people develop bindings for C libraries= , by providing information language-specific information, depending on cert= ain compiler, processor architecture, operating system, etc.<br><br>Current= ly there are only aliases for C built-in types, which are static if-ed to h= ave the correct size for the respective C compilers.<br> <br>It's well-documented and waits to be enhanced with more accurate co= mpile-time branching and additional useful information to make binding C co= de even easier.<br><br>If we get a good enough C compatibility module, we&#= 39;ll be able to rapidly bind all major and frequently-used libraries and i= nclude them in phobos.<br> <br>This will also do a great job of promoting D as a good language to adop= t for serious projects, because it's standard library will be very rich= and common usage won't require the programmer to resort to anything be= sides phobos.<br> <br>Any comments would be much appreciated.<br> --0015174c3f0cefa40404ad6efa68--
Sep 21 2011
On 21-09-2011 10:01, Gor Gyolchanyan wrote:Hello, my dear, beloved D community. I've been reading literally all discussions on D.puremagic.com <http://D.puremagic.com> for about a month now and I'm deeply concerned with my favorite language and it's reference compiler. So, for starters, i decided to add a very useful (in my opinion) module to phobos: etc.c.compat. Here's the pull request: https://github.com/D-Programming-Language/phobos/pull/265 This module is supposed to help people develop bindings for C libraries, by providing information language-specific information, depending on certain compiler, processor architecture, operating system, etc. Currently there are only aliases for C built-in types, which are static if-ed to have the correct size for the respective C compilers. It's well-documented and waits to be enhanced with more accurate compile-time branching and additional useful information to make binding C code even easier. If we get a good enough C compatibility module, we'll be able to rapidly bind all major and frequently-used libraries and include them in phobos. This will also do a great job of promoting D as a good language to adopt for serious projects, because it's standard library will be very rich and common usage won't require the programmer to resort to anything besides phobos. Any comments would be much appreciated.
Hi, You should probably fix the enum member names to use camelCase (though in the case of 'x86_64', I think the underscore is acceptable). - Alex
Sep 21 2011
Will do! :-) Right after i take a look at the existing core.stdc.config module, that i never knew about before :-)
Sep 21 2011
Gor Gyolchanyan Wrote:Hello, my dear, beloved D community. I've been reading literally all discussions on D.puremagic.com for about a month now and I'm deeply concerned with my favorite language and it's reference compiler. So, for starters, i decided to add a very useful (in my opinion) module to phobos: etc.c.compat. Here's the pull request: https://github.com/D-Programming-Language/phobos/pull/265 This module is supposed to help people develop bindings for C libraries, by providing information language-specific information, depending on certain compiler, processor architecture, operating system, etc. Currently there are only aliases for C built-in types, which are static if-ed to have the correct size for the respective C compilers.
Isn't this almost exactly like stdint https://github.com/D-Programming-Language/druntime/blob/master/src/core/stdc/stdint.d except that it isn't based on target architecture and can specify specific compilers? Also how much do sizes differ between compilers?
Sep 21 2011
I didn't know about core.stdc package because it doesn't show u on dpl.org. The difference is, that some compilers make long 64 bit for 64-bit systems, and some leave the long 32-bit no matter what.
Sep 21 2011
For that, there are a number of GC-related bugs to be fixed. If GC gets fully stable and predictable, C-managed memory could be integrated in concert with GC (like, making the GC call C-AI's custom free function on collection cycle).
Sep 21 2011
On 2011-09-21 21:02, Gor F. Gyolchanyan wrote:I didn't know about core.stdc package because it doesn't show u on dpl.org. The difference is, that some compilers make long 64 bit for 64-bit systems, and some leave the long 32-bit no matter what.
core.stdc.config handles that. -- /Jacob Carlborg
Sep 22 2011
On 9/21/11, Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> wrote:If we get a good enough C compatibility module, we'll be able to rapidly bind all major and frequently-used libraries and include them in phobos.
Type compatibility might be just the tip of the iceberg for wrapping a C library. For example you might also have to worry about memory management, and then there are libraries that use special introspection mechanisms to generate language bindings, e.g. GObject.
Sep 21 2011









Gor F. Gyolchanyan <gor.f.gyolchanyan gmail.com> 