Re: htod (8.52.5n) not recognizing wchar_t?
Thanks!
Re: htod (8.52.5n) not recognizing wchar_t?
On Tuesday, September 26, 2017 07:33:57 DanielG via Digitalmars-d-learn wrote: > According to this page (https://dlang.org/htod.html), wchar_t > should be recognized as wchar. But I'm just getting an error: > "Error: ')' expected" ... anywhere a wchar_t appears in my .h > file. > > Anything I need to do? I'd prefer to keep this entire file > uncommented so I don't always have to hand-edit the results of > htod. I find it quite surprising that it doesn't like wchar_t, but depending on what version of C it's converting to, maybe wchar_t isn't officially part of it. I don't know. I would have expected it to work. However, regardless of this specific issue, htod hasn't been updated in quite a while, and if you really want to be automatically generating C bindings, I'd suggest that you look at dstep, which uses clang: http://code.dlang.org/packages/dstep https://github.com/jacob-carlborg/dstep - Jonathan M Davis
htod (8.52.5n) not recognizing wchar_t?
According to this page (https://dlang.org/htod.html), wchar_t should be recognized as wchar. But I'm just getting an error: "Error: ')' expected" ... anywhere a wchar_t appears in my .h file. Anything I need to do? I'd prefer to keep this entire file uncommented so I don't always have to hand-edit the results of htod. cheers
Re: HTOD
On 2017-08-28 20:24, 12345swordy wrote: What compiler are you referring to? Clang? LDC? DMD? The D compilers, DMD and LDC. -- /Jacob Carlborg
Re: HTOD
On Monday, 28 August 2017 at 06:30:53 UTC, Jacob Carlborg wrote: On 2017-08-26 23:32, 12345swordy wrote: I am not asking that, I'm asking regarding the project mention earlier. Adding support for C++ to DStep is a long term goal, yes. But the compiler still needs to support those features. Unless DStep is going to generate C wrappers, which I would like to avoid. What compiler are you referring to? Clang? LDC? DMD?
Re: HTOD
On 2017-08-26 23:32, 12345swordy wrote: I am not asking that, I'm asking regarding the project mention earlier. Adding support for C++ to DStep is a long term goal, yes. But the compiler still needs to support those features. Unless DStep is going to generate C wrappers, which I would like to avoid. -- /Jacob Carlborg
Re: HTOD
On 2017-08-25 16:58, Walter Bright wrote: Right, but please show me an example of how that might be used. I've never suggested that this should be implemented. -- /Jacob Carlborg
Re: HTOD
On Thursday, 24 August 2017 at 19:08:04 UTC, Jacob Carlborg wrote: On 2017-08-24 17:02, 12345swordy wrote: They have plans to add c++ support? D can already link with C++, but not all features are supported. Like lambdas, for example, are not supported. I am not asking that, I'm asking regarding the project mention earlier.
Re: HTOD
On 8/25/2017 1:31 AM, Jacob Carlborg wrote: On 2017-08-25 02:43, Walter Bright wrote: I have no idea how that would even work. Since lambdas are nested functions, how would one write one in D and have it nested inside C++ code? I thought C++ lambdas were implemented as structs with the call operator overloaded. Right, but please show me an example of how that might be used.
Re: HTOD
On 2017-08-25 13:07, Atila Neves wrote: Correct, the lambda syntax is just syntatic sugar. But how would D support that? The name of the compiler-generated struct is known only to the compiler, there'd be no way to link to the code. I don't know. I haven't suggested this should be implemented. -- /Jacob Carlborg
Re: HTOD
On Friday, 25 August 2017 at 08:31:57 UTC, Jacob Carlborg wrote: On 2017-08-25 02:43, Walter Bright wrote: I have no idea how that would even work. Since lambdas are nested functions, how would one write one in D and have it nested inside C++ code? I thought C++ lambdas were implemented as structs with the call operator overloaded. Correct, the lambda syntax is just syntatic sugar. But how would D support that? The name of the compiler-generated struct is known only to the compiler, there'd be no way to link to the code. Atila
Re: HTOD
On 2017-08-25 02:43, Walter Bright wrote: I have no idea how that would even work. Since lambdas are nested functions, how would one write one in D and have it nested inside C++ code? I thought C++ lambdas were implemented as structs with the call operator overloaded. -- /Jacob Carlborg
Re: HTOD
On Friday, 25 August 2017 at 00:43:56 UTC, Walter Bright wrote: On 8/24/2017 12:08 PM, Jacob Carlborg wrote: D can already link with C++, but not all features are supported. Like lambdas, for example, are not supported. I have no idea how that would even work. Since lambdas are nested functions, how would one write one in D and have it nested inside C++ code? Like this: // C++ void foo(std::functionfn) { printf("%s", fn(3)); } // D extern(C++) void foo(char* delegate(int) fn); -- Biotronic
Re: HTOD
On 8/24/2017 12:08 PM, Jacob Carlborg wrote: D can already link with C++, but not all features are supported. Like lambdas, for example, are not supported. I have no idea how that would even work. Since lambdas are nested functions, how would one write one in D and have it nested inside C++ code?
Re: HTOD
On 8/24/2017 12:53 AM, lobo wrote: D had 1 ICE that was a known issue with core team member comments on the bug report. What's the bugzilla issue number?
Re: HTOD
On 2017-08-24 17:02, 12345swordy wrote: They have plans to add c++ support? D can already link with C++, but not all features are supported. Like lambdas, for example, are not supported. -- /Jacob Carlborg
Re: HTOD
On Thursday, 24 August 2017 at 08:11:52 UTC, Jacob Carlborg wrote: On 2017-08-23 15:25, 12345swordy wrote: "Doesn't translate C++ at all" That's very disappointing. IMO, it should at least aim for the c++ 11 feature via using clang. Pull requests are welcome :). BTW, to my knowledge D doesn't support any features added after C++98/03. They have plans to add c++ support?
Re: HTOD
On 2017-08-23 15:25, 12345swordy wrote: "Doesn't translate C++ at all" That's very disappointing. IMO, it should at least aim for the c++ 11 feature via using clang. Pull requests are welcome :). BTW, to my knowledge D doesn't support any features added after C++98/03. -- /Jacob Carlborg
Re: HTOD
On Thursday, 24 August 2017 at 05:56:02 UTC, Timothee Cour wrote: On Wed, Aug 23, 2017 at 10:38 PM, lobo via Digitalmars-dwrote: On Thursday, 24 August 2017 at 01:51:25 UTC, Timothee Cour wrote: [...] nim: it supports both targetting C++ (as well as C or javascript) and also calling C++ via foreign function interface, eg here are some links: https://github.com/nim-lang/Nim/wiki/Playing-with-CPP--VTABLE-from-Nim https://stackoverflow.com/questions/29526958/wrapping-nested-templated-types-in-nim https://forum.nim-lang.org/t/1056 for D, there's a project to support full C++ natively using clang library is calypso, unfortunalty I haven't been able to use it, either from OSX or ubuntu: it's blocked by https://github.com/Syniurge/Calypso/issues/41, hoping someone can help here! On Wed, Aug 23, 2017 at 3:57 PM, lobo via Digitalmars-d wrote: [...] Thanks, I'll revisit Nim. As a team we're testing new languages as a larger plan to switch from C++. Nim we struck off 6 months ago because we found it not quite production ready. bye, lobo Would love to hear more about your reasoning as I'm also occasionally re-visiting it, do you have any writeup? No write up I can release at this stage because there are some business confidential aspects in the final report. We're ~30 Python, Java and C++ programmers. Our testing involved 1 developer month in each language implementing scripts to parse into data, a basic library read and interpolate data on a 3D regular grid, a small GUI application to display regular grids and tool chain testing where we produced a metric tonne of autogenerated code to see how well we could integrate into our existing build infrastructure and what build times would be like. From memory Nim had four main issues: a) 4 compiler ICEs. Our metric was >2 during testing and it was out, so this alone blew Nim away; we were deliberately harsh. D had 1 ICE that was a known issue with core team member comments on the bug report. b) Nim compilation was slower than other languages (we count the C compilation as part of the same package) c) Our Python devs found Nim was not Pythonic enough compared to other languages for hack n' slash quick scripts while keeping it maintainable and clean. d) Our developers (Python, Java and C++ people) preferred other language syntax bye, lobo
Re: HTOD
On Wed, Aug 23, 2017 at 10:38 PM, lobo via Digitalmars-dwrote: > On Thursday, 24 August 2017 at 01:51:25 UTC, Timothee Cour wrote: >>> >>> [...] >> >> >> nim: >> it supports both targetting C++ (as well as C or javascript) and also >> calling C++ via foreign function interface, eg here are some links: >> https://github.com/nim-lang/Nim/wiki/Playing-with-CPP--VTABLE-from-Nim >> >> https://stackoverflow.com/questions/29526958/wrapping-nested-templated-types-in-nim >> https://forum.nim-lang.org/t/1056 >> >> for D, there's a project to support full C++ natively using clang library >> is calypso, unfortunalty I haven't been able to use it, either from OSX or >> ubuntu: it's blocked by https://github.com/Syniurge/Calypso/issues/41, >> hoping someone can help here! >> >> >> >> On Wed, Aug 23, 2017 at 3:57 PM, lobo via Digitalmars-d >> wrote: >>> >>> [...] > > > Thanks, I'll revisit Nim. As a team we're testing new languages as a larger > plan to switch from C++. Nim we struck off 6 months ago because we found it > not quite production ready. > > bye, > lobo Would love to hear more about your reasoning as I'm also occasionally re-visiting it, do you have any writeup?
Re: HTOD
On Thursday, 24 August 2017 at 01:51:25 UTC, Timothee Cour wrote: [...] nim: it supports both targetting C++ (as well as C or javascript) and also calling C++ via foreign function interface, eg here are some links: https://github.com/nim-lang/Nim/wiki/Playing-with-CPP--VTABLE-from-Nim https://stackoverflow.com/questions/29526958/wrapping-nested-templated-types-in-nim https://forum.nim-lang.org/t/1056 for D, there's a project to support full C++ natively using clang library is calypso, unfortunalty I haven't been able to use it, either from OSX or ubuntu: it's blocked by https://github.com/Syniurge/Calypso/issues/41, hoping someone can help here! On Wed, Aug 23, 2017 at 3:57 PM, lobo via Digitalmars-dwrote: [...] Thanks, I'll revisit Nim. As a team we're testing new languages as a larger plan to switch from C++. Nim we struck off 6 months ago because we found it not quite production ready. bye, lobo
Re: HTOD
> Do you know another language or tool that can call C++ natively? nim: it supports both targetting C++ (as well as C or javascript) and also calling C++ via foreign function interface, eg here are some links: https://github.com/nim-lang/Nim/wiki/Playing-with-CPP--VTABLE-from-Nim https://stackoverflow.com/questions/29526958/wrapping-nested-templated-types-in-nim https://forum.nim-lang.org/t/1056 for D, there's a project to support full C++ natively using clang library is calypso, unfortunalty I haven't been able to use it, either from OSX or ubuntu: it's blocked by https://github.com/Syniurge/Calypso/issues/41, hoping someone can help here! On Wed, Aug 23, 2017 at 3:57 PM, lobo via Digitalmars-dwrote: > On Wednesday, 23 August 2017 at 13:25:20 UTC, 12345swordy wrote: >> >> On Tuesday, 22 August 2017 at 19:55:53 UTC, Jacob Carlborg wrote: >>> >>> On 2017-08-22 19:47, 12345swordy wrote: >>> Use Clang frontend? >>> >>> >>> DStep [1] is doing that. It handles both GCC and Microsoft extensions. >>> >>> [1] https://github.com/jacob-carlborg/dstep >> >> >> "Doesn't translate C++ at all" >> >> That's very disappointing. IMO, it should at least aim for the c++ 11 >> feature via using clang. > > > Do you know another language or tool that can call C++ natively? I'm looking > for native C++ interop either built in or via tooling. > > bye, > lobo > >
Re: HTOD
On Wednesday, 23 August 2017 at 13:25:20 UTC, 12345swordy wrote: On Tuesday, 22 August 2017 at 19:55:53 UTC, Jacob Carlborg wrote: On 2017-08-22 19:47, 12345swordy wrote: Use Clang frontend? DStep [1] is doing that. It handles both GCC and Microsoft extensions. [1] https://github.com/jacob-carlborg/dstep "Doesn't translate C++ at all" That's very disappointing. IMO, it should at least aim for the c++ 11 feature via using clang. Do you know another language or tool that can call C++ natively? I'm looking for native C++ interop either built in or via tooling. bye, lobo
Re: HTOD
On Wednesday, 23 August 2017 at 14:12:55 UTC, jmh530 wrote: On Wednesday, 23 August 2017 at 13:25:20 UTC, 12345swordy wrote: "Doesn't translate C++ at all" That's very disappointing. IMO, it should at least aim for the c++ 11 feature via using clang. Very disappointing? Yes I find it disappointing. Does my disappointment bother you?
Re: HTOD
On Wednesday, 23 August 2017 at 13:25:20 UTC, 12345swordy wrote: "Doesn't translate C++ at all" That's very disappointing. IMO, it should at least aim for the c++ 11 feature via using clang. Very disappointing? It's not trivial to call C++ from another language.
Re: HTOD
On Tuesday, 22 August 2017 at 19:55:53 UTC, Jacob Carlborg wrote: On 2017-08-22 19:47, 12345swordy wrote: Use Clang frontend? DStep [1] is doing that. It handles both GCC and Microsoft extensions. [1] https://github.com/jacob-carlborg/dstep "Doesn't translate C++ at all" That's very disappointing. IMO, it should at least aim for the c++ 11 feature via using clang.
Re: HTOD
On Tuesday, 22 August 2017 at 22:50:46 UTC, Walter Bright wrote: On 8/22/2017 2:50 PM, Steven Schveighoffer wrote: But it is generating D code, no? Sure. And the C subset of D has been very stable, too. Used the tool 2 years ago. Worked like a charm.
Re: HTOD
On 8/22/2017 2:50 PM, Steven Schveighoffer wrote: On 8/22/17 5:17 PM, Walter Bright wrote: On 8/22/2017 11:23 AM, Steven Schveighoffer wrote: I downloaded it. The exe is last modified April 28, 2010, corresponding with DMD version 2.044. This can't possibly produce valid D headers for 2.075.1. I think it should be either updated or removed from the web site. It doesn't correspond to the D version, it corresponds to the C compiler version, which is stable. But it is generating D code, no? Sure. And the C subset of D has been very stable, too.
Re: HTOD
On 8/22/17 5:17 PM, Walter Bright wrote: On 8/22/2017 11:23 AM, Steven Schveighoffer wrote: I downloaded it. The exe is last modified April 28, 2010, corresponding with DMD version 2.044. This can't possibly produce valid D headers for 2.075.1. I think it should be either updated or removed from the web site. It doesn't correspond to the D version, it corresponds to the C compiler version, which is stable. But it is generating D code, no? -Steve
Re: HTOD
On 8/22/2017 11:23 AM, Steven Schveighoffer wrote: I downloaded it. The exe is last modified April 28, 2010, corresponding with DMD version 2.044. This can't possibly produce valid D headers for 2.075.1. I think it should be either updated or removed from the web site. It doesn't correspond to the D version, it corresponds to the C compiler version, which is stable.
Re: HTOD
On 2017-08-22 19:47, 12345swordy wrote: Use Clang frontend? DStep [1] is doing that. It handles both GCC and Microsoft extensions. [1] https://github.com/jacob-carlborg/dstep -- /Jacob Carlborg
Re: HTOD
On 8/22/17 1:15 PM, Walter Bright wrote: On 8/22/2017 8:14 AM, Jonathan Shamir wrote: https://dlang.org/htod.html I click download and get an exe! And in the bugs section: No linux version. I'll start with the productive part. If anyone can point me out to the sources of htod I would love to compile for linux + osx. Any task seems more attractive to me than manually converting a 1000 line header to D. You're right about htod, and it's on me. It's built out of the DMC++ front end. I haven't gotten around yet to releasing it as open source. I downloaded it. The exe is last modified April 28, 2010, corresponding with DMD version 2.044. This can't possibly produce valid D headers for 2.075.1. I think it should be either updated or removed from the web site. -Steve
Re: HTOD
On Tuesday, 22 August 2017 at 17:15:27 UTC, Walter Bright wrote: You're right about htod, and it's on me. It's built out of the DMC++ front end. I haven't gotten around yet to releasing it as open source. We can discuss possible ways of implementing htod. Instead, I'd rather discuss how we can make D more approachable and attractive to people thinking of picking up the language. In that respect, as far as htod goes, I think it should be removed from the site (it could still be available online). D can't have an official command line utility that doesn't work. Small steps.
Re: HTOD
On Tuesday, 22 August 2017 at 17:15:27 UTC, Walter Bright wrote: On 8/22/2017 8:14 AM, Jonathan Shamir wrote: [...] You're right about htod, and it's on me. It's built out of the DMC++ front end. I haven't gotten around yet to releasing it as open source. [...] Use Clang frontend?
HTOD
On 8/22/2017 8:14 AM, Jonathan Shamir wrote: https://dlang.org/htod.html I click download and get an exe! And in the bugs section: No linux version. I'll start with the productive part. If anyone can point me out to the sources of htod I would love to compile for linux + osx. Any task seems more attractive to me than manually converting a 1000 line header to D. You're right about htod, and it's on me. It's built out of the DMC++ front end. I haven't gotten around yet to releasing it as open source. The second problem is the DMC++ front end is tuned to deal with Windows compiler extensions, not Linux compiler extensions. So compiling it and running it on Linux will fail because every non-trivial C header file writer is unable to resist using every extension. There's also the gcc problem with its reliance on many hundreds (!) of predefined macros that are turned on/off by various gcc compiler switches. It's a madhouse. And, of course, every gcc on every platform has a different set of these. The situation was so bad that when I developed Warp (a fast C preprocessor) I left the predefined list up to the user to load from a special file. gcc on Ubuntu has 240 predefined macros when using the default switches. Who knows what the full list actually is. gcc -dM -E - https://stackoverflow.com/questions/2224334/gcc-dump-preprocessor-defines
Re: htod for linux
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [1]: "No Linux version." https://dlang.org/htod.html However, I wouldn't be surprised to get good results on wine.
Re: htod for linux
You may also want to try dstep - I just recently used that tool for the first time, and it worked really well (required a bit of tweaking of the source and result files though, but nothing major). => https://github.com/jacob-carlborg/dstep
Re: htod for linux
I think we need a dub package for the cpp standard library. If somebody has managed to get that together, it would be a great step towards better cpp interoperability.
Re: htod for linux
On Friday, 21 April 2017 at 12:10:04 UTC, Mike Parker wrote: The only thing I'm aware of is Binderoo [1]. According to the currently skinny wiki, binderoo_util [2] can be used to generate bindings if you're invested in using the whole set up. Ethan's scheduled to give a talk about it on Day 2 of DConf [3]. [1] https://github.com/Remedy-Entertainment/binderoo/wiki [2] https://github.com/Remedy-Entertainment/binderoo/wiki/binderoo_util [3] http://dconf.org/2017/talks/watson.html Thanks, I'll try that.
Re: htod for linux
On Friday, 21 April 2017 at 12:04:02 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand. base_string.h is ugly, is arcane, even a parser would have a hard time with it. Hopefully it gets in core.stdcpp in the future. The only thing I'm aware of is Binderoo [1]. According to the currently skinny wiki, binderoo_util [2] can be used to generate bindings if you're invested in using the whole set up. Ethan's scheduled to give a talk about it on Day 2 of DConf [3]. [1] https://github.com/Remedy-Entertainment/binderoo/wiki [2] https://github.com/Remedy-Entertainment/binderoo/wiki/binderoo_util [3] http://dconf.org/2017/talks/watson.html
Re: htod for linux
On Friday, 21 April 2017 at 11:40:45 UTC, Mike Parker wrote: "No Linux version." That's a shame, any alternative with cpp support? It's quite painful to "port" something ubiquitous like std::string by hand. base_string.h is ugly, is arcane, even a parser would have a hard time with it. Hopefully it gets in core.stdcpp in the future.
Re: htod for linux
On Friday, 21 April 2017 at 10:54:26 UTC, سليمان السهمي (Soulaïman Sahmi) wrote: Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp. From the very bottom of the htod doc page [1]: "No Linux version." https://dlang.org/htod.html
htod for linux
Is there an htod for linux or an equivalent that works with Cpp, there is dstep but it does not support Cpp.
[Issue 6349] HTOD needs -od or -of switch
https://issues.dlang.org/show_bug.cgi?id=6349 Andrej Mitrovicchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #1 from Andrej Mitrovic --- dstep (https://github.com/jacob-carlborg/dstep) should be used instead, marking as wontfix. --
[Issue 6239] HTOD: Add support for converting opaque C types to D
https://issues.dlang.org/show_bug.cgi?id=6239 Andrej Mitrovicchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #5 from Andrej Mitrovic --- dstep supports this feature (https://github.com/jacob-carlborg/dstep), marking as wontfix. --
Re: Linux and htod
On Thursday, 16 June 2016 at 19:04:38 UTC, bachmeier wrote: On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f Just to clarify, so as to prevent confusion by someone that randomly stumbles across this post, you do not need htod, dstep, or any other tool to call C libraries from D. dstep generates bindings to C libraries for you. You can create the bindings yourself in your D source files, and if you only want to call a couple of functions from a particular C library, that's the most convenient. http://dlang.org/spec/interfaceToC.html The wording of the question implies that one of these tools is required to call into C libraries, which is not correct. https://wiki.dlang.org/D_binding_for_C is also helpful they should be put together.
Re: Linux and htod
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f Just to clarify, so as to prevent confusion by someone that randomly stumbles across this post, you do not need htod, dstep, or any other tool to call C libraries from D. dstep generates bindings to C libraries for you. You can create the bindings yourself in your D source files, and if you only want to call a couple of functions from a particular C library, that's the most convenient. http://dlang.org/spec/interfaceToC.html The wording of the question implies that one of these tools is required to call into C libraries, which is not correct.
Re: Linux and htod
On Thursday, 16 June 2016 at 12:39:00 UTC, Dicebot wrote: On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f People don't use htod. https://github.com/jacob-carlborg/dstep is best what one can be for plain binding generation. Thanks, I'll check it out. This was always a barrier for me to take the effort of learning D
Re: Linux and htod
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f People don't use htod. https://github.com/jacob-carlborg/dstep is best what one can be for plain binding generation.
Re: Linux and htod
On Thursday, 16 June 2016 at 12:23:09 UTC, fbmac wrote: How people use it on Linux, if htod is required to import C libraries and windows only?f we don't.
Linux and htod
How people use it on Linux, if htod is required to import C libraries and windows only?f
Re: htod question
On Friday, 22 January 2016 at 01:04:50 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that. The library includes various C header files ... causing htod to fail Yeah, htod often requires preparing the files your trying to convert. Often removing macro's and the like. Its a manual process, and it can get dirty.
Re: htod question
On 2016-01-22 01:31, Dibyendu Majumdar wrote: I tried using htod but got errors as it could not handle the std C header files (Visual C++). How do people work around this? You could try DStep [1]. Although I'm not entirely sure if it works on Windows. It uses libclang, so if Clang can handle the header file it should work in DStep as well. [1] https://github.com/jacob-carlborg/dstep -- /Jacob Carlborg
Re: htod question
On Friday, 22 January 2016 at 00:31:01 UTC, Dibyendu Majumdar wrote: I tried using htod but got errors as it could not handle the std C header files (Visual C++). And probably never will. D doesn't have a preprocessor so it's kind of hard to automate the process. How do people work around this? Thanks and Regards Dibyendu They don't. Counter question: What's so bad about the D std library ?
Re: htod question
On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that.
htod question
I tried using htod but got errors as it could not handle the std C header files (Visual C++). How do people work around this? Thanks and Regards Dibyendu
Re: htod question
On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that. The library includes various C header files ... causing htod to fail
Re: htod question
On Friday, 22 January 2016 at 01:04:50 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 01:03:09 UTC, Dibyendu Majumdar wrote: On Friday, 22 January 2016 at 00:52:59 UTC, W.J. wrote: Counter question: What's so bad about the D std library ? I am trying to create bindings for existing C library so I was trying to use htod for that. The library includes various C header files ... causing htod to fail I see. I didn't quite understand your question correctly. I thought you were trying to port over the std c library. Maybe you can give an example ?
[Issue 4876] New D component htod needed
https://issues.dlang.org/show_bug.cgi?id=4876 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Version|unspecified |D2 --
[Issue 4876] New D component htod needed
https://issues.dlang.org/show_bug.cgi?id=4876 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|general |websites Product|puremagic.com |D --
[Issue 6239] HTOD: Add support for converting opaque C types to D
https://issues.dlang.org/show_bug.cgi?id=6239 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|htod|tools --
[Issue 6237] htod generates invalid module name and declaration
https://issues.dlang.org/show_bug.cgi?id=6237 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|htod|tools --
[Issue 6248] HTOD leaves out const when translating C headers
https://issues.dlang.org/show_bug.cgi?id=6248 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|htod|tools --
[Issue 6349] HTOD needs -od or -of switch
https://issues.dlang.org/show_bug.cgi?id=6349 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|htod|tools --
[Issue 6249] HTOD deletes files without notice
https://issues.dlang.org/show_bug.cgi?id=6249 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|htod|tools --
[Issue 6292] HTOD hides constants behind a comment
https://issues.dlang.org/show_bug.cgi?id=6292 Andrei Alexandrescu and...@erdani.com changed: What|Removed |Added Component|htod|tools --
Re: HTOD: Low hanging fruit
On 2013-12-07 18:53, Andre wrote: If DStep is the prefered solution would it be possible to also provide a pre compiled binary for windows? This would make DStep more user friendly. = Just trying to find out what is needed to compile DStep on a windows machine, whether I need mambo/tango/s.th. else and praying libclang is available for MS Windows... :) To build DStep you need Tango, a couple of my libraries (mambo, dstack) and libclang. I plan to make it available through Dub. libclang is available for Windows. They provide experimental binaries for MinGW for version 3.1 and 3.2. I have already tried to build it on Windows, unfortunately it fails to pass the DStep tests. I think it was a segfault or similar. I haven't investigated any further. -- /Jacob Carlborg
Re: HTOD: Low hanging fruit
If DStep is the prefered solution would it be possible to also provide a pre compiled binary for windows? This would make DStep more user friendly. = Just trying to find out what is needed to compile DStep on a windows machine, whether I need mambo/tango/s.th. else and praying libclang is available for MS Windows... :) Kind regards André
HTOD: Low hanging fruit
Hi, HTOD is not able to translate a #define if the value is in brackets like here: #define SQL_STILL_EXECUTING 2 #define SQL_ERROR (-1) #define SQL_INVALID_HANDLE (-2) #define SQL_NEED_DATA 99 (Example from ODBC header file sql.h) This seems like a low hanging fruit. Kind regards André
HTOD: Low hanging fruit
Hi, HTOD is not able to translate a #define if the value is in brackets like here: #define SQL_STILL_EXECUTING 2 #define SQL_ERROR (-1) #define SQL_INVALID_HANDLE (-2) #define SQL_NEED_DATA 99 (Example from ODBC header file sql.h) This seems like a low hanging fruit. Kind regards André
Re: HTOD: Low hanging fruit
strange, sent once but posted 2 times on server On Friday, 6 December 2013 at 15:04:58 UTC, Andre wrote: Hi, HTOD is not able to translate a #define if the value is in brackets like here: #define SQL_STILL_EXECUTING 2 #define SQL_ERROR (-1) #define SQL_INVALID_HANDLE (-2) #define SQL_NEED_DATA 99 (Example from ODBC header file sql.h) This seems like a low hanging fruit. Kind regards André
Re: HTOD: Low hanging fruit
On Friday, 6 December 2013 at 15:04:18 UTC, Andre wrote: Hi, HTOD is not able to translate a #define if the value is in brackets like here: #define SQL_STILL_EXECUTING 2 #define SQL_ERROR (-1) #define SQL_INVALID_HANDLE (-2) #define SQL_NEED_DATA 99 (Example from ODBC header file sql.h) This seems like a low hanging fruit. Kind regards André htod is old and unsupported. I recommend dstep (https://github.com/jacob-carlborg/dstep) which is based on libclang and thus naturally up to date with current C state.
Re: HTOD: Low hanging fruit
To be honest I'd love htod to be completely removed from dlang.org (and possibly replaced with dstep) as it does more harm than good.
Re: HTOD: Low hanging fruit
On 2013-12-06 16:14, Dicebot wrote: htod is old and unsupported. I recommend dstep (https://github.com/jacob-carlborg/dstep) which is based on libclang and thus naturally up to date with current C state. DStep doesn't currently support any preprocessor handling, except for some simple includes. The C interface for libclang need to be extended to support handling the preprocessor as well. Contributions are always welcome. -- /Jacob Carlborg
Re: HTOD: Low hanging fruit
On Friday, 6 December 2013 at 17:02:18 UTC, Jacob Carlborg wrote: On 2013-12-06 16:14, Dicebot wrote: htod is old and unsupported. I recommend dstep (https://github.com/jacob-carlborg/dstep) which is based on libclang and thus naturally up to date with current C state. DStep doesn't currently support any preprocessor handling, except for some simple includes. The C interface for libclang need to be extended to support handling the preprocessor as well. Contributions are always welcome. Does it simply ignores preprocessor tokens or actually makes substitutions (but there is no D-ification)? I thought it is the latter.
Re: HTOD: Low hanging fruit
On 2013-12-06 18:10, Dicebot wrote: Does it simply ignores preprocessor tokens or actually makes substitutions (but there is no D-ification)? I thought it is the latter. It does substitutions. I guess using libclang would be just like compiling with Clang but stop the process somewhere after the AST is created and before the code generating phase has started. -- /Jacob Carlborg
Re: HTOD: Low hanging fruit
On 2013-12-06 18:13, Jacob Carlborg wrote: It does substitutions. I guess using libclang would be just like compiling with Clang but stop the process somewhere after the AST is created and before the code generating phase has started. This also has the unfortunate consequences that you can only generate bindings for one platform. -- /Jacob Carlborg
Re: HTOD: Low hanging fruit
On 12/6/13, Jacob Carlborg d...@me.com wrote: On 2013-12-06 18:13, Jacob Carlborg wrote: It does substitutions. I guess using libclang would be just like compiling with Clang but stop the process somewhere after the AST is created and before the code generating phase has started. This also has the unfortunate consequences that you can only generate bindings for one platform. I guess libtooling (http://clang.llvm.org/docs/LibTooling.html) would be a better fit for a codegenerator, but it's a C++ library.
Re: HTOD: Low hanging fruit
On 12/6/13 7:15 AM, Dicebot wrote: To be honest I'd love htod to be completely removed from dlang.org (and possibly replaced with dstep) as it does more harm than good. I agree. Please send a pull request. Thanks, Andrei
Re: HTOD: Low hanging fruit
On 2013-12-06 19:35, Andrej Mitrovic wrote: I guess libtooling (http://clang.llvm.org/docs/LibTooling.html) would be a better fit for a codegenerator, but it's a C++ library. I don't see what this would give me. libclang already handles command line parsing. DStep handles, in addition to those specified, all flags that Clang handles. -- /Jacob Carlborg
Re: HTOD: Low hanging fruit
On 2013-12-06 19:35, Andrej Mitrovic wrote: I guess libtooling (http://clang.llvm.org/docs/LibTooling.html) would be a better fit for a codegenerator, but it's a C++ library. What would be better is to use the Clang C++ libraries since they already provide all the functionality needed. Although they are not stable and are C++ libraries. I'm actually quite satisfied I've come this far without needing to change a single thing in libclang itself. -- /Jacob Carlborg
Is there any chance of htod being improved or ported to other platforms?
Is there any chance of htod being improved or ported to other platforms? http://dlang.org/htod.html Is this tool still capable or is it a legacy tool now?
Re: Is there any chance of htod being improved or ported to other platforms?
On Thursday, 14 November 2013 at 15:22:28 UTC, Gary Willoughby wrote: Is there any chance of htod being improved or ported to other platforms? http://dlang.org/htod.html Is this tool still capable or is it a legacy tool now? It does not reliably work even on Windows. Legacy. Use dstep (https://github.com/jacob-carlborg/dstep)
Re: Is there any chance of htod being improved or ported to other platforms?
On Thursday, 14 November 2013 at 15:25:37 UTC, Dicebot wrote: On Thursday, 14 November 2013 at 15:22:28 UTC, Gary Willoughby wrote: Is there any chance of htod being improved or ported to other platforms? http://dlang.org/htod.html Is this tool still capable or is it a legacy tool now? It does not reliably work even on Windows. Legacy. Use dstep (https://github.com/jacob-carlborg/dstep) Shall replace the above link towards htod with one towards dstep or at least add a big red message at the top of the htod page.
Re: Walter: htod on github?
On 2013-05-28 04:32, Lionello Lunesu wrote: Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to Windows header files. Perhaps we can combine the two into a new utility? There's already DStep, fully open source: https://github.com/jacob-carlborg/dstep Cross-platform, can convert C and Objective-C. Unfortunately I haven't got it to link on Windows, stupid Optlink. I'll guess I should give it another try. -- /Jacob Carlborg
Re: Walter: htod on github?
On 5/28/13 12:11, Walter Bright wrote: On 5/27/2013 8:35 PM, Lionello Lunesu wrote: On 5/28/13 11:08, Diggory wrote: On Tuesday, 28 May 2013 at 02:32:24 UTC, Lionello Lunesu wrote: Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to Windows header files. Perhaps we can combine the two into a new utility? Lio. I think htod is based on dmc so open sourcing it would be a problem. Ah, right. I remember now :) HTOD is using the DMC frontend for C/H parsing and that's not open sourced. Got it. I've been thinking about making it source available. What about keeping the DMC frontend code in a (static) library? Would that work for the time being? L.
Walter: htod on github?
Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to Windows header files. Perhaps we can combine the two into a new utility? Lio.
Re: Walter: htod on github?
On Tuesday, 28 May 2013 at 02:32:24 UTC, Lionello Lunesu wrote: Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to Windows header files. Perhaps we can combine the two into a new utility? Lio. I think htod is based on dmc so open sourcing it would be a problem.
Re: Walter: htod on github?
On 5/28/13 11:08, Diggory wrote: On Tuesday, 28 May 2013 at 02:32:24 UTC, Lionello Lunesu wrote: Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to Windows header files. Perhaps we can combine the two into a new utility? Lio. I think htod is based on dmc so open sourcing it would be a problem. Ah, right. I remember now :) HTOD is using the DMC frontend for C/H parsing and that's not open sourced. Got it. L.
Re: Walter: htod on github?
On 5/27/2013 8:35 PM, Lionello Lunesu wrote: On 5/28/13 11:08, Diggory wrote: On Tuesday, 28 May 2013 at 02:32:24 UTC, Lionello Lunesu wrote: Walter, Any chance we can get the source of htod? If found it a very useful little utility, although there are many issues with it. VisualD also include a similar utility to convert header files to D, but it is more tuned to Windows header files. Perhaps we can combine the two into a new utility? Lio. I think htod is based on dmc so open sourcing it would be a problem. Ah, right. I remember now :) HTOD is using the DMC frontend for C/H parsing and that's not open sourced. Got it. I've been thinking about making it source available.
[Issue 6248] HTOD leaves out const when translating C headers
http://d.puremagic.com/issues/show_bug.cgi?id=6248 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||WONTFIX --- Comment #2 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-11-02 06:04:03 PDT --- We have better (cross-platform) tools for .h conversion, not gonna wait for Walter. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6249] HTOD deletes files without notice
http://d.puremagic.com/issues/show_bug.cgi?id=6249 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||WONTFIX --- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-11-02 06:03:30 PDT --- I must have been very angry when I filed this. :p Anyway we have better (cross-platform) tools for .h conversion now. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 6292] HTOD hides constants behind a comment
http://d.puremagic.com/issues/show_bug.cgi?id=6292 Andrej Mitrovic andrej.mitrov...@gmail.com changed: What|Removed |Added Status|NEW |RESOLVED Resolution||WONTFIX --- Comment #1 from Andrej Mitrovic andrej.mitrov...@gmail.com 2012-11-02 06:04:09 PDT --- We have better (cross-platform) tools for .h conversion, not gonna wait for Walter. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
htod - const
I have this file tmp.h: const char *getvalue(const char *key); I run htod tmp.h and I've got the output --- /* Converted to D from tmp.h by htod */ module tmp; //C const char *getvalue(const char *key); extern (C): char * getvalue(char *key); --- Why is 'const' removed?
Re: htod - const
Why is 'const' removed? cause htod sucks. D1 didn't have const and htod wasn't updated for ages.
Re: htod - const
trass3r, I wouldn't say that it sucks. It has really helped a lot in porting some simple header files. It goes terribly bad on the more complex though.
Re: htod - const
Thanks Trass3r. On Tue, Mar 6, 2012, at 05:50 PM, Trass3r wrote: Why is 'const' removed? cause htod sucks. D1 didn't have const and htod wasn't updated for ages.
Re: htod - const
Am 06.03.2012, 20:13 Uhr, schrieb maarten van damme maartenvd1...@gmail.com: I wouldn't say that it sucks. It has really helped a lot in porting some simple header files. It goes terribly bad on the more complex though. Sadly, using regular expressions is much more efficient. At least those don't destroy the source by removing const, comments, evaluating preprocessor directives, etc.
Re: htod - const
On 3/6/12, Trass3r u...@known.com wrote: Sadly, using regular expressions is much more efficient. Do you have some script that does that and sorta works? I've tried others (e.g. dstep but couldn't get LLVM to compile unfortunately..).
Re: htod
Thank you very much, that solved my issue. C:\dirhtod -I c:\d\dm\include ocilib.h Fatal error: unable to open input file 'stdlib.h' You have an extra space there. Use: htod -IC:\d\dm\include ocilib.h That will work.