Re: How to force console
On Wednesday, 1 August 2018 at 20:57:30 UTC, Everlast wrote: I can create a console for a dll using AllocConsole and special Write functions but this is a pain. How do I get all standard input and output to either use this console or for the app to create the console automatically? The problem I'm having is that I can write(using custom write) but can't read. I'd rather just have a dll with a normal console window like a normal program. I do have `-L/SUBSYSTEM:CONSOLE` but no console appears. As far as I know, that only works with executables. Loading a DLL does not trigger the opening of a console. You'll have to stick with AllocConsole and redirect the I/O. http://www.asawicki.info/news_1326_redirecting_standard_io_to_windows_console.html
Re: Where is TypeInfo_Class.m_init set
On Tuesday, 31 July 2018 at 20:45:11 UTC, kinke wrote: Sorry, scratch that, I forgot the `extern` before the dummy global. After fixing that, I didn't quickly find a solution for referencing the symbol in the .data.rel.ro section (LLVM asm, e.g., `void* getInit() { return __asm!(void*)("movq test.C.__init, %rax", "={rax}"); }` doesn't work either). The compiler could emit the init symbol as regular global for `-betterC` though. --- This issue could also be tackled in the D ctor of the extern(C++) class, by injecting the blit before the actual ctor body. C++ code wouldn't have to take care about that D-interop incompatibility anymore (independent of -betterC). I looked into that approach a little and it was pretty successful, at least for DMD: https://run.dlang.io/is/KDHoI9 LDC complains about the type of initializer though: onlineapp.d(22): Error: Global variable type does not match previous declaration with same mangled name: _D5bclib3Baz6__initZ onlineapp.d(22):Previous IR type: %bclib.Baz = type { [1 x i8*]*, i32 } onlineapp.d(22):New IR type: %bclib.BazInitializer = type { [1 x i8*]*, i32, [4 x i8] } Any ideas on how to match the type exactly? I don't quite understand why there are 4 bytes at the back of BazInitializer.
Re: pointer cast from const(Y) to immutable(void*)** is not supported at compile time
On Thursday, 2 August 2018 at 02:13:41 UTC, Hakan Aras wrote: On Thursday, 2 August 2018 at 01:39:58 UTC, Nicholas Wilson wrote: https://issues.dlang.org/show_bug.cgi?id=19134 I wasn't quite sure whether it's a bug since it happens in both compilers. Thanks for opening the issue. For future reference the only time you should consider LDC/GDC distinct from DMD is codegen, i.e. compiler causes your code to crash. This is a frontend bug so it affects all the major compilers. As a workaround remove static, as that causes y to be initialised at compile time. I do want it at compiletime though. static here has nothing to do with static_cast in C++. The analogy to a static_cast would be const X x = new Y(); casting up the hierarchy, as opposed to dynamic casting down the hierarchy. Sorry, I actually meant a reinterpret_cast. I always get those mixed up. But now that I look at it again I don't see how that would help me, since my code isn't the one trying to to casting. Ah, unfortunately you're stuck then.
Re: pointer cast from const(Y) to immutable(void*)** is not supported at compile time
On Thursday, 2 August 2018 at 01:39:58 UTC, Nicholas Wilson wrote: https://issues.dlang.org/show_bug.cgi?id=19134 I wasn't quite sure whether it's a bug since it happens in both compilers. Thanks for opening the issue. As a workaround remove static, as that causes y to be initialised at compile time. I do want it at compiletime though. static here has nothing to do with static_cast in C++. The analogy to a static_cast would be const X x = new Y(); casting up the hierarchy, as opposed to dynamic casting down the hierarchy. Sorry, I actually meant a reinterpret_cast. I always get those mixed up. But now that I look at it again I don't see how that would help me, since my code isn't the one trying to to casting.
Re: pointer cast from const(Y) to immutable(void*)** is not supported at compile time
On Wednesday, 1 August 2018 at 20:10:44 UTC, Hakan Aras wrote: On Wednesday, 1 August 2018 at 16:25:28 UTC, Hakan Aras wrote: https://run.dlang.io/is/dSVruv Whoops, that was the wrong one. It's fixed now. https://issues.dlang.org/show_bug.cgi?id=19134 As a workaround remove static, as that causes y to be initialised at compile time. static here has nothing to do with static_cast in C++. The analogy to a static_cast would be const X x = new Y(); casting up the hierarchy, as opposed to dynamic casting down the hierarchy.
How to force console
I can create a console for a dll using AllocConsole and special Write functions but this is a pain. How do I get all standard input and output to either use this console or for the app to create the console automatically? The problem I'm having is that I can write(using custom write) but can't read. I'd rather just have a dll with a normal console window like a normal program. I do have `-L/SUBSYSTEM:CONSOLE` but no console appears.
Re: pointer cast from const(Y) to immutable(void*)** is not supported at compile time
On Wednesday, 1 August 2018 at 16:25:28 UTC, Hakan Aras wrote: https://run.dlang.io/is/dSVruv Whoops, that was the wrong one. It's fixed now.
Re: Gui framework
On Wednesday, 1 August 2018 at 18:40:26 UTC, Everlast wrote: On Wednesday, 1 August 2018 at 17:24:23 UTC, Andre Pany wrote: On Wednesday, 1 August 2018 at 15:28:32 UTC, Greatsam4sure wrote: Please help me recommend a gui toolkit for dlang, that has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *Support theming and skinning *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s) You could look at Delta. It is a bridge between Delphi and D. That means you can design your application visually in Delphi RAD Studio using the great UI toolkit Firemonkey. But every line of code is written in D. It combines the best of 2 worlds. Embarcadero released a community version of Delphi some weeks ago. https://github.com/andre2007/delta-core-10-2-1 Kind regards Andre Interesting... how well does this work? mind creating a bit more useful example that shows off things? It's nice to have a hello world but the lure is not strong enough for me... Hello worlds generally work but without a more complex example I can only assume that it probably will be a PITA when creating a real app. The prototypes I created so far, also a complex application, worked well. What definitely is missing, only a small subset of the available Delphi components are wrapped. Creating/enhancing existing wrappers is rather easy (see e.g. https://github.com/andre2007/delta-fmx-10-2-1/blob/master/source/FMX/Memo.d) I tried to create a Pascal parser which should generate the D wrappers but stopped due to time constraints. Kind regards Andre
Re: Gui framework
On Wednesday, 1 August 2018 at 17:24:23 UTC, Andre Pany wrote: On Wednesday, 1 August 2018 at 15:28:32 UTC, Greatsam4sure wrote: Please help me recommend a gui toolkit for dlang, that has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *Support theming and skinning *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s) You could look at Delta. It is a bridge between Delphi and D. That means you can design your application visually in Delphi RAD Studio using the great UI toolkit Firemonkey. But every line of code is written in D. It combines the best of 2 worlds. Embarcadero released a community version of Delphi some weeks ago. https://github.com/andre2007/delta-core-10-2-1 Kind regards Andre Interesting... how well does this work? mind creating a bit more useful example that shows off things? It's nice to have a hello world but the lure is not strong enough for me... Hello worlds generally work but without a more complex example I can only assume that it probably will be a PITA when creating a real app.
Re: D2H
On Wednesday, 1 August 2018 at 17:01:28 UTC, Everlast wrote: On Wednesday, 1 August 2018 at 15:55:28 UTC, Everlast wrote: On Wednesday, 1 August 2018 at 15:48:27 UTC, Everlast wrote: Is there any program that can take a D file and essentially make an H file for other programs to import for dll work? I want to create the DLL's in D rather than C++ and would like to generate the H file from the D file. Also, when I try to load a dll generated by matlab(the target) it says that it is an invalid dll. see http://matlab.izmiran.ru/help/techdoc/matlab_external/ch2_sha6.html Maybe you can get a simple dll to work? import core.sys.windows.windows; import core.sys.windows.dll; export extern(C) int foo() { return 42; } mixin SimpleDllMain; and for the .h file __declspec(dllimport) int foo(); then in matlab unloadlibrary test loadlibrary test calllib('test', 'foo') seems to work out. To auto generate, simply set the options to generate the interface file then use something like sed sed -i "/^\(export\)/!d" file sed -i -e "s/export extern (C)/__declspec(dllimport)/g" file and this will extract the exports and fix up things for matlab to use.
Re: Gui framework
On Wednesday, 1 August 2018 at 15:28:32 UTC, Greatsam4sure wrote: Please help me recommend a gui toolkit for dlang, that has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *Support theming and skinning *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s) You could look at Delta. It is a bridge between Delphi and D. That means you can design your application visually in Delphi RAD Studio using the great UI toolkit Firemonkey. But every line of code is written in D. It combines the best of 2 worlds. Embarcadero released a community version of Delphi some weeks ago. https://github.com/andre2007/delta-core-10-2-1 Kind regards Andre
Re: Gui framework
On 2018-08-01 17:28, Greatsam4sure wrote: Please help me recommend a gui toolkit for dlang, that has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *Support theming and skinning *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s) DWT [1] works well in Windows, have a native look and feel but as far as themeing and customization it's a bit limited. It's a port of the Java library SWT, so all tutorials and documentation for SWT applies to DWT as well. [1] https://github.com/d-widget-toolkit/dwt -- /Jacob Carlborg
Re: D2H
On Wednesday, 1 August 2018 at 15:55:28 UTC, Everlast wrote: On Wednesday, 1 August 2018 at 15:48:27 UTC, Everlast wrote: Is there any program that can take a D file and essentially make an H file for other programs to import for dll work? I want to create the DLL's in D rather than C++ and would like to generate the H file from the D file. Also, when I try to load a dll generated by matlab(the target) it says that it is an invalid dll. see http://matlab.izmiran.ru/help/techdoc/matlab_external/ch2_sha6.html Maybe you can get a simple dll to work? import core.sys.windows.windows; import core.sys.windows.dll; export extern(C) int foo() { return 42; } mixin SimpleDllMain; and for the .h file __declspec(dllimport) int foo(); then in matlab unloadlibrary test loadlibrary test calllib('test', 'foo') seems to work out.
Re: Small program producing binary with large filesize
Thank you for all of the great answers, everyone!
pointer cast from const(Y) to immutable(void*)** is not supported at compile time
Why does the following work in DMD 2.080 and LDC 1.10, but not in DMD 2.081 and LDC 1.11 beta: https://run.dlang.io/is/dSVruv And is there a way to enforce the cast like a static_cast in C++?
Re: Gui framework
I am using gtkd and is really nice, but AFAIK it does not have native looking on windows yet On Wed, Aug 1, 2018 at 5:30 PM Greatsam4sure via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> wrote: > Please help me recommend a gui toolkit for dlang, that has the > following > * work well on windows > *look native on windows > *support css styling like adobe flex > spark toolkit and javafx > *Support theming and skinning > *support custom chrome. That is easily > customizable. > *Integrate well with dlang. > *Has fairly OK tutorials > > I will appreciate your help(s) >
Re: Is there a way to anonymously execute some sh script contents?
On Wednesday, 1 August 2018 at 14:58:56 UTC, Ky-Anh Huynh wrote: This works well with user interaction. However I don't really like the idea of using temporary files. Is there any better way? Maybe take a look at: https://dlang.org/library/std/process/pipe_shell.html
Re: Small program producing binary with large filesize
On Tuesday, 31 July 2018 at 15:19:19 UTC, Dan Barbarito wrote: Hi all, I am starting to write a command line tool. Hi! First, Vibe.d will increase your binary size because it contains a lot of unnecessary things inside it. So instead of using the entire vibe.d library, you may point dub to specific vibe.d parts, like `vibe.d:core`, `vibe.d:http` etc. If you put the whole vibe.d framework as a dub dependency and use it like `import vibe;` the things like mongodb drivers, email libraries, redis driver etc. will be linked to your binary as well, even if you don't need them. Second, you need to compile your code in the release mode to cut all debug information out of it. Also, you can try to use the `strip` command line tool to cut all export symbols if your binary is an executable file, not a library. This will reduce the size. In some cases a lot. The third thing is already mentioned: by default, the DMD compiler builds and links the code statically. In other words, your binary contains parts of the DRuntime and the Phobos libraries (those parts that you've used in your program). This thing helps to distribute compiled binaries without external dependencies (except libc and libpthread), because your binary is already contains all needed stuff. If you're not happy with it, you can try to use the LDC compiler, which uses the dynamic linking by default. Your binary will be really tiny, but in order to execute it, you'll need to have the libdruntime.so and libphobos.so installed in your system. This may add additional issues if you plan to distribute your program. Sadly, we still don't have the D runtime libraries installed in all popular OSes. Currently only the libc has this privilege 😀 I hope the situation will change in the future.
Re: D2H
On Wednesday, 1 August 2018 at 15:48:27 UTC, Everlast wrote: Is there any program that can take a D file and essentially make an H file for other programs to import for dll work? I want to create the DLL's in D rather than C++ and would like to generate the H file from the D file. Also, when I try to load a dll generated by matlab(the target) it says that it is an invalid dll. see http://matlab.izmiran.ru/help/techdoc/matlab_external/ch2_sha6.html Maybe you can get a simple dll to work?
D2H
Is there any program that can take a D file and essentially make an H file for other programs to import for dll work? I want to create the DLL's in D rather than C++ and would like to generate the H file from the D file.
Gui framework
Please help me recommend a gui toolkit for slang, the has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s)
Gui framework
Please help me recommend a gui toolkit for dlang, that has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *Support theming and skinning *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s)
Gui framework
Please help me recommend a gui toolkit for dlang, the has the following * work well on windows *look native on windows *support css styling like adobe flex spark toolkit and javafx *support custom chrome. That is easily customizable. *Integrate well with dlang. *Has fairly OK tutorials I will appreciate your help(s)
Is there a way to anonymously execute some sh script contents?
Hi, I have some big shell script that may require user input. Using `pipeProcess` doesn't work as `pipe` doesn't allow user to provide custom input (FIXME). I am creating some temporary files, put the script contents to that file and then invoke [code] spawnProcess([/path/to/shell, /path/to/temporary/script/file]); [/code] This works well with user interaction. However I don't really like the idea of using temporary files. Is there any better way? Thanks for your reading.
Re: Why does not UFCS work for method defined inside unittest block?
On Tuesday, 31 July 2018 at 08:42:28 UTC, Simen Kjærås wrote: From https://dlang.org/spec/function.html#pseudo-member: "A free function can be called with a syntax that looks as if the function were a member function of its first parameter type." [...] Thanks a lot Simen :)