digitalmars.D - using C with D
- Micah Heyer (13/13) Jul 21 2007 Hi everyone,
- Gregor Richards (4/18) Jul 21 2007 Not only is it feasible, I did it months ago.
- Saaa (3/6) Jul 21 2007 What exactly is the difference between bcd and htod?
- Gregor Richards (5/16) Jul 22 2007 1) bcd.gen is F/OSS
- Saaa (4/8) Jul 22 2007 Ah ok :)
- Gregor Richards (9/22) Jul 22 2007 Macros are always a problem, but I haven't found them as problematic
- Chris Nicholson-Sauls (6/32) Jul 24 2007 The sad and scary thing is... I had to read that last line a few times
- BCS (2/13) Jul 24 2007 http://www.metafilter.com/28301/Scrambled-Text
- Frits van Bommel (12/25) Jul 24 2007 For the non-Dutch-speaking audience:
- Chris Nicholson-Sauls (10/37) Jul 24 2007 Dictionary in hand, it was, I'll admit it. :) I haven't actually used
- BCS (2/18) Jul 24 2007 The mind can read through a lot of mangling
- Gregor Richards (7/33) Jul 24 2007 Oh come on people :P
- Derek Parnell (6/44) Jul 24 2007 What do you mean?
- Sean Kelly (7/10) Jul 22 2007 I haven't tried bcd yet, but in my experience, htod doesn't actually
- Anders Bergh (5/7) Jul 21 2007 I don't think I've thanked you for bcd... it's a great tool! It works
- Micah Heyer (22/28) Jul 23 2007 Ah, thats a nifty little program,I think info about it should be placed
- Gregor Richards (9/39) Jul 23 2007 Because of how GCCXML works internally, it's easier to alias the
Hi everyone, Lately I've been taking another look at D and I've been thinking about using it instead of c++,but the single most thing holding me back is the ability to use C libraries with out having to recreate the headers.I understand why this feature was left out of D,but with out the ability to easily use C libraries I just have to stick with C++.To me one of the strengths of C++ and probably one of the reasons it is in use as much as it is to day is that it is backwards compatible with C. So here is what I'm wondering: would it be possible, through modification of gcc,to have the compiler export a D style symbol table for importing into D projects?Is this a ridiculous idea or would it actully be feasible? -micah
Jul 21 2007
Micah Heyer wrote:Hi everyone, Lately I've been taking another look at D and I've been thinking about using it instead of c++,but the single most thing holding me back is the ability to use C libraries with out having to recreate the headers.I understand why this feature was left out of D,but with out the ability to easily use C libraries I just have to stick with C++.To me one of the strengths of C++ and probably one of the reasons it is in use as much as it is to day is that it is backwards compatible with C. So here is what I'm wondering: would it be possible, through modification of gcc,to have the compiler export a D style symbol table for importing into D projects?Is this a ridiculous idea or would it actully be feasible? -micahNot only is it feasible, I did it months ago. http://www.dsource.org/projects/bcd/ - Gregor Richards
Jul 21 2007
What exactly is the difference between bcd and htod? I've read both of the websites and am I right to say they both rewrite the header file to a D compatible module?Not only is it feasible, I did it months ago. http://www.dsource.org/projects/bcd/ - Gregor Richards
Jul 21 2007
Saaa wrote:What exactly is the difference between bcd and htod? I've read both of the websites and am I right to say they both rewrite the header file to a D compatible module?1) bcd.gen is F/OSS 2) bcd.gen is portable 3) bcd.gen supports (limited) C++ - Gregor RichardsNot only is it feasible, I did it months ago. http://www.dsource.org/projects/bcd/ - Gregor Richards
Jul 22 2007
Ah ok :) Just a question, nothing concrete, but should I report faulty translations? (.h(C) to .d) Or do you know of limitations(such as Sean Kelly reports about htod)1) bcd.gen is F/OSS 2) bcd.gen is portable 3) bcd.gen supports (limited) C++ - Gregor Richards
Jul 22 2007
Saaa wrote:Ah ok :) Just a question, nothing concrete, but should I report faulty translations? (.h(C) to .d) Or do you know of limitations(such as Sean Kelly reports about htod)Macros are always a problem, but I haven't found them as problematic with bcd.gen as Sean apparently has with htod. I don't know if this is due to different implementation, or just because I haven't tested bcd.gen on the same kinds of things. Yes, report failures directly to my email. I may or may not fix :P Confusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor Richards1) bcd.gen is F/OSS 2) bcd.gen is portable 3) bcd.gen supports (limited) C++ - Gregor Richards
Jul 22 2007
Gregor Richards wrote:Saaa wrote:The sad and scary thing is... I had to read that last line a few times before it occured to me what was strange about it... 0_o Must be my 0.125 Dutch blood coming through. Ik begrijp u. Ik ben niet trots van het. ;p -- Chris Nicholson-SaulsAh ok :) Just a question, nothing concrete, but should I report faulty translations? (.h(C) to .d) Or do you know of limitations(such as Sean Kelly reports about htod)Macros are always a problem, but I haven't found them as problematic with bcd.gen as Sean apparently has with htod. I don't know if this is due to different implementation, or just because I haven't tested bcd.gen on the same kinds of things. Yes, report failures directly to my email. I may or may not fix :P Confusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor Richards1) bcd.gen is F/OSS 2) bcd.gen is portable 3) bcd.gen supports (limited) C++ - Gregor Richards
Jul 24 2007
Reply to Chris Nicholson-Sauls,Gregor Richards wrote:http://www.metafilter.com/28301/Scrambled-TextConfusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor RichardsThe sad and scary thing is... I had to read that last line a few times before it occured to me what was strange about it... 0_o Must be my 0.125 Dutch blood coming through. Ik begrijp u. Ik ben niet trots van het. ;p
Jul 24 2007
BCS wrote:Reply to Chris Nicholson-Sauls,For the non-Dutch-speaking audience: "Ik begrijp u" == "I understand you" (though "u" is the formal form of "you", and I'd probably have used the informal "je" in that sentence). That second sentence should probably be "Ik ben er niet trots op". The way you wrote it looks like a Babelfish-like translation of "I'm not proud of it" (i.e. a dictionary-in-hand/browser word-for-word translation, seemingly not taking grammar into account). I'm not sure why you'd bring up Dutch though, except perhaps as a reason to be used to words being in the "wrong" order. (I'm pretty sure the word order Gregor used makes about as little sense in Dutch as in English, and Gregor seems be from Portland...)Gregor Richards wrote:Confusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor RichardsThe sad and scary thing is... I had to read that last line a few times before it occured to me what was strange about it... 0_o Must be my 0.125 Dutch blood coming through. Ik begrijp u. Ik ben niet trots van het. ;p
Jul 24 2007
Frits van Bommel wrote:BCS wrote:Dictionary in hand, it was, I'll admit it. :) I haven't actually used any Dutch in almost seven years... it was an excuse to go digging through crates for that dictionary. Never know what other nifty things you'll find buried away in your own closets. As to the reason... yeah, that's basically it, although yes the case in point makes no sense either way. But one thing I've noticed is the Dutch end of my family has a peculiar tendency to utter ubiquitous phrases somewhat scrambled. Don't really know why, but it happens. -- Chris Nicholson-SaulsReply to Chris Nicholson-Sauls,For the non-Dutch-speaking audience: "Ik begrijp u" == "I understand you" (though "u" is the formal form of "you", and I'd probably have used the informal "je" in that sentence). That second sentence should probably be "Ik ben er niet trots op". The way you wrote it looks like a Babelfish-like translation of "I'm not proud of it" (i.e. a dictionary-in-hand/browser word-for-word translation, seemingly not taking grammar into account). I'm not sure why you'd bring up Dutch though, except perhaps as a reason to be used to words being in the "wrong" order. (I'm pretty sure the word order Gregor used makes about as little sense in Dutch as in English, and Gregor seems be from Portland...)Gregor Richards wrote:Confusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor RichardsThe sad and scary thing is... I had to read that last line a few times before it occured to me what was strange about it... 0_o Must be my 0.125 Dutch blood coming through. Ik begrijp u. Ik ben niet trots van het. ;p
Jul 24 2007
Reply to Benjamin,Reply to Chris Nicholson-Sauls,The mind can read through a lot of manglingGregor Richards wrote:http://www.metafilter.com/28301/Scrambled-TextConfusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor RichardsThe sad and scary thing is... I had to read that last line a few times before it occured to me what was strange about it... 0_o Must be my 0.125 Dutch blood coming through. Ik begrijp u. Ik ben niet trots van het. ;p
Jul 24 2007
Gregor Richards wrote:Saaa wrote:Oh come on people :P It's not scrambled, it's backwards, it says: By the way, please don't top-post in newsgroups, it makes things very confusing. Get it? Get it? Yeesh. - Gregor RichardsAh ok :) Just a question, nothing concrete, but should I report faulty translations? (.h(C) to .d) Or do you know of limitations(such as Sean Kelly reports about htod)Macros are always a problem, but I haven't found them as problematic with bcd.gen as Sean apparently has with htod. I don't know if this is due to different implementation, or just because I haven't tested bcd.gen on the same kinds of things. Yes, report failures directly to my email. I may or may not fix :P Confusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor Richards1) bcd.gen is F/OSS 2) bcd.gen is portable 3) bcd.gen supports (limited) C++ - Gregor Richards
Jul 24 2007
What do you mean? -- Derek Parnell Melbourne, Australia "giggles" On Tue, 24 Jul 2007 19:54:56 -0700, Gregor Richards wrote:Gregor Richards wrote:Saaa wrote:Oh come on people :P It's not scrambled, it's backwards, it says: By the way, please don't top-post in newsgroups, it makes things very confusing. Get it? Get it? Yeesh. - Gregor RichardsAh ok :) Just a question, nothing concrete, but should I report faulty translations? (.h(C) to .d) Or do you know of limitations(such as Sean Kelly reports about htod)Macros are always a problem, but I haven't found them as problematic with bcd.gen as Sean apparently has with htod. I don't know if this is due to different implementation, or just because I haven't tested bcd.gen on the same kinds of things. Yes, report failures directly to my email. I may or may not fix :P Confusing very things makes it, newsgroups in post-top don't please, way the by. - Gregor Richards1) bcd.gen is F/OSS 2) bcd.gen is portable 3) bcd.gen supports (limited) C++ - Gregor Richards
Jul 24 2007
Saaa wrote:What exactly is the difference between bcd and htod? I've read both of the websites and am I right to say they both rewrite the header file to a D compatible module?I haven't tried bcd yet, but in my experience, htod doesn't actually work that well for headers including macros (which seems to be most C headers I've actually needed to convert). I found it was often faster to convert headers by hand than it was to run them through htod and then do manual cleanup afterwards. Sean
Jul 22 2007
On 7/22/07, Gregor Richards <Richards codu.org> wrote:Not only is it feasible, I did it months ago. http://www.dsource.org/projects/bcd/I don't think I've thanked you for bcd... it's a great tool! It works on nearly anything I feed it. -- Anders
Jul 21 2007
Gregor Richards wrote:Not only is it feasible, I did it months ago. http://www.dsource.org/projects/bcd/ - Gregor RichardsAh, thats a nifty little program,I think info about it should be placed in the faq.One question though: What's all the aliased function pointers I keep getting in the output? alias int function(void *, void *) _BCD_func__788; alias int function(void *) _BCD_func__409; alias int function(void *, long *, int) _BCD_func__411; alias int function(void *, char *, uint) _BCD_func__413; alias int function(void *, char *, uint) _BCD_func__415; alias void function(void *) _BCD_func__895; alias int function(void * *, char *) _BCD_func__896; alias int function(char *, char * * *, uint *) _BCD_func__897; alias int function(void *, char *, char *, char *, char *) _BCD_func__898; alias int function(__gconv_step *, __gconv_step_data *, void *, char *, char * *, char *, char * *, uint *) _BCD_func__899; alias void function(__gconv_step *) _BCD_func__900; alias int function(__gconv_step *) _BCD_func__901; alias uint function(__gconv_step *, char) _BCD_func__902; alias int function(__gconv_step *, __gconv_step_data *, char * *, char *, char * *, uint *, int, int) _BCD_func__903; I was converting sdl headers btw. -micah
Jul 23 2007
Micah Heyer wrote:Gregor Richards wrote:Because of how GCCXML works internally, it's easier to alias the functions to alternative names in one step, and then use those alternative names in another step. It's a bit weird, but it doesn't make life any more difficult so long as you stick to this one rule: Don't use the generated .d files as documentation, use the .h files :) - Gregor Richards PS: The lines with gconv_step is a bug I haven't tracked down. It's easy to fix the generated headers by just removing those lines.Not only is it feasible, I did it months ago. http://www.dsource.org/projects/bcd/ - Gregor RichardsAh, thats a nifty little program,I think info about it should be placed in the faq.One question though: What's all the aliased function pointers I keep getting in the output? alias int function(void *, void *) _BCD_func__788; alias int function(void *) _BCD_func__409; alias int function(void *, long *, int) _BCD_func__411; alias int function(void *, char *, uint) _BCD_func__413; alias int function(void *, char *, uint) _BCD_func__415; alias void function(void *) _BCD_func__895; alias int function(void * *, char *) _BCD_func__896; alias int function(char *, char * * *, uint *) _BCD_func__897; alias int function(void *, char *, char *, char *, char *) _BCD_func__898; alias int function(__gconv_step *, __gconv_step_data *, void *, char *, char * *, char *, char * *, uint *) _BCD_func__899; alias void function(__gconv_step *) _BCD_func__900; alias int function(__gconv_step *) _BCD_func__901; alias uint function(__gconv_step *, char) _BCD_func__902; alias int function(__gconv_step *, __gconv_step_data *, char * *, char *, char * *, uint *, int, int) _BCD_func__903; I was converting sdl headers btw. -micah
Jul 23 2007