Re: Iterating chars by Word

2020-11-12 Thread evilrat via Digitalmars-d-learn
On Friday, 13 November 2020 at 05:14:08 UTC, Виталий Фадеев wrote: Is: wchar[] chars; // like a: "import core.sys.windows.windows;\nimport std.conv : to;\n" Goal: foreach ( word; chars.byWord ) { // ... } You can make your own range, however look at this function first (second

Re: Getting Qte5 to work

2020-10-28 Thread evilrat via Digitalmars-d-learn
On Tuesday, 27 October 2020 at 11:46:02 UTC, Josh Dredge wrote: Hi all, I'm completely new to D and while I'm not new to programming in general, I mostly do web development, Welcome! If by web development you also have back-end programming then you should be like 50% know how desktop

Re: How to compile Windows exe files from this source

2020-08-09 Thread evilrat via Digitalmars-d-learn
On Sunday, 9 August 2020 at 19:04:07 UTC, Marc wrote: I don't know much more about D than creating a 'hello world' exe file with the DMD Compiler but I'm interested in using the eBay/tsv-utils binaries. Unfortunately, the author didn't create any MS Windows binaries:

Re: Bind C++ class to DLang : undefined reference to `Canvas::Foo()'

2020-07-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 July 2020 at 09:34:35 UTC, zoujiaqing wrote: I changed string to basic_string. /// source/main.d import std.stdio; import core.stdcpp.string; extern(C++) { class Canvas { @disable this(); static Canvas Create(); basic_string!ubyte Foo();

Re: Does std.net.curl: download have support for callbacks?

2020-06-11 Thread evilrat via Digitalmars-d-learn
On Thursday, 11 June 2020 at 06:05:09 UTC, adnan338 wrote: I would like to set a callback for the `download()` function but I do not seem to find a way to add a callback to the procedure. Let's say, for example I have a GtkD Widget called "pb" (short for progressBar). I want to download a

Re: Interfacing with C++ std::shared_ptr and std::unique_ptr

2020-06-10 Thread evilrat via Digitalmars-d-learn
On Wednesday, 10 June 2020 at 06:43:24 UTC, Andre Pany wrote: Also, the C++ classes make use of templates. Is it still possible to call these classes from D? It should be, I did something similar and it worked. But it was quite some time ago so I don't remember exact situation and any

Re: `this` template params for struct not expressing constness.

2020-06-08 Thread evilrat via Digitalmars-d-learn
On Monday, 8 June 2020 at 07:35:12 UTC, adnan338 wrote: Hi, as far as I understand, the `this` template parameter includes constness qualifiers as seen in https://ddili.org/ders/d.en/templates_more.html To apply this I have this following struct: module bst; struct Tree(T) { T item;

Re: Linker error under Ubuntu

2020-05-15 Thread evilrat via Digitalmars-d-learn
On Friday, 15 May 2020 at 23:49:37 UTC, solidstate1991 wrote: Dub should do the linking by itself. How does it know what to link?

Re: Linker error under Ubuntu

2020-05-14 Thread evilrat via Digitalmars-d-learn
On Thursday, 14 May 2020 at 16:09:16 UTC, solidstate1991 wrote: When I try to compile my own project under Ubuntu with dub, I get the following linker error: /usr/bin/ld: .dub/obj/pixelperfectengine_pixelperfecteditor.o: undefined reference to symbol 'inflateEnd'

Re: Can I use Dlang in Qt5 instead C++ for develop Android Apps?

2020-04-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 April 2020 at 21:01:50 UTC, Baby Beaker wrote: I want develop Android apps using Qt5. But C++ is very hard. I want to use Dlang becouse Dlang is very easy. In theory nothing stops you from doing that. In practice however you have to deal with C++ anyway, how API matches ABI, and

Re: Is it possible to store different subclasses in one array?

2020-04-12 Thread evilrat via Digitalmars-d-learn
On Monday, 13 April 2020 at 04:21:48 UTC, Leonardo wrote: foreach (ref gi; GameItems) { if (gi == Weapon) gi.Attack() } How would it be? Replying myself... weapon = cast(Weapon) gi; if (weapon !is null) weapon.Attack() can be simplified as: if (auto weapon =

Re: Link error undefined symbol: __imp__InterlockedIncrement@4 on windows

2020-04-10 Thread evilrat via Digitalmars-d-learn
On Thursday, 9 April 2020 at 14:07:10 UTC, Clayton Alves wrote: I'm trying to compile my first hello world dub project, but when I run "dub" it spits this error: lld-link: error: undefined symbol: __imp__InterlockedIncrement@4 Does anybody have any clues what is going on ? This is from

Re: A question about C++ interop

2020-03-28 Thread evilrat via Digitalmars-d-learn
On Saturday, 28 March 2020 at 19:14:38 UTC, YD wrote: Hi, now I have a further question: when the C++ class A actually has a method that looks like virtual void get_info(std::string ) const = 0; in order to preserve the virtual function table layout (I found that if I omit this

Re: dub libs from home directory on windows

2020-03-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 March 2020 at 19:53:58 UTC, jmh530 wrote: On Wednesday, 18 March 2020 at 15:10:52 UTC, Виталий Фадеев wrote: On Wednesday, 18 March 2020 at 13:52:20 UTC, Abby wrote: I cannot build my app, so I was wondering if there is some clever way to solve this without hardcoded path to

Re: AA code 50x slower

2020-02-16 Thread evilrat via Digitalmars-d-learn
On Monday, 17 February 2020 at 02:18:15 UTC, AlphaPurned wrote: But the input to the AA is static, it never changes. I thought D would essentially treat it as a constant and compute it once? (I'm only using the AA in one place but it is in another template that is used twice. I can't

Re: AA code 50x slower

2020-02-16 Thread evilrat via Digitalmars-d-learn
On Sunday, 16 February 2020 at 12:57:43 UTC, AlphaPurned wrote: template AA(string[] S) { auto _do() { int[string] d; foreach(s; S) d[s] = 0; return d; } enum AA = _do; } My best guess is that enum arrays(except strings) and AA's are instantiated every time you access them.

Re: How the hell to split multiple delims?

2020-02-16 Thread evilrat via Digitalmars-d-learn
On Sunday, 16 February 2020 at 09:57:26 UTC, AlphaPurned wrote: 1>Test.d(31): error : template ... 1>Test.d(61): error : template ... 1>Test.d(66): error : cannot implicitly convert expression `l` of type `immutable(char)` to `string` 1>Test.d(31): error : template ... 1>Test.d(79): error :

Re: How to check that import module will succeed?

2019-07-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 July 2019 at 14:56:37 UTC, Andrey Zherikov wrote: Even without static if I get the same result: mixin template my_import(alias modName) { mixin("import " ~ modName ~ ";"); } mixin my_import!"mymod"; pragma(msg,fullyQualifiedName!(myfunc)); // Error: undefined identifier

Re: How to check that import module will succeed?

2019-07-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 July 2019 at 03:42:58 UTC, Andrey Zherikov wrote: Is there a way to check whether some module, say "foo", is available for import before doing "import foo"? I did some really retarded utility like this in the past, worked for me, but I can't say it is that well tested and there

Re: Wrong vtable for COM interfaces that don't inherit IUnknown

2019-07-15 Thread evilrat via Digitalmars-d-learn
On Monday, 15 July 2019 at 22:01:25 UTC, KytoDragon wrote: I am currently trying to write a XAudio2 backend and have come across the problem, that some of the interfaces for XAudio2's COM objects seem to be missing the first entry in their vtable. After reading the iterface article in the spec

Re: Heterogeneous Variadic Arguments with Other Arguments

2019-07-14 Thread evilrat via Digitalmars-d-learn
On Sunday, 14 July 2019 at 03:51:14 UTC, harakim wrote: I wanted to do this: package int serialize(byte[] destination, int offset, T...)(T values) Can't really tell what's going on without call site and what do you exactly mean by "heterogeneous arguments with other arguments", but

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 27 June 2019 at 17:00:01 UTC, Rémy Mouëza wrote: I though support for C++ allocation had improved. In a recent release, there was the addition of core.stdcpp.new, but I didn't try it out: - http://dpldocs.info/experimental-docs/core.stdcpp.new_.html -

Re: question about call cpp class constructer without new , and define cpp delegate

2019-06-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 27 June 2019 at 05:37:08 UTC, ChangLoong wrote: If I want call cpp class constructer without new method, is there a way to do that ? If what you really want is to actually allocate using C++ new operator from D, then that is very problematic and not portable even across

Re: How can I override the defeat compiler select by Dub?

2019-06-23 Thread evilrat via Digitalmars-d-learn
On Sunday, 23 June 2019 at 23:10:48 UTC, Mike Brockus wrote: If you never seen Meson before then pick up a camera and take a picture: 樂  https://mesonbuild.com/ Nope. Wasn't working on Windows last time I checked. Hometown Meson user here simply just wondering how can I tell Dub to use

Re: Using python in D

2019-06-09 Thread evilrat via Digitalmars-d-learn
On Sunday, 9 June 2019 at 03:42:23 UTC, rnd wrote: Thanks for guidance. I also wanted to know: Once executable is successfully created, will it work on systems where Python and pandas are not installed? That is unlikely. PyD is just a D package, it doesn't have the ability to mess up with

Re: 1 - 17 ms, 553 ╬╝s, and 1 hnsec

2019-05-18 Thread evilrat via Digitalmars-d-learn
On Thursday, 16 May 2019 at 15:19:03 UTC, Alex wrote: 1 - 17 ms, 553 ╬╝s, and 1 hnsec fancy useless asci hieroglyphic Holy shirt! All that time I was thinking this is just some sort of encoding artifacts in terminal(common problem on windows), especially because IIRC on Linux it is

Re: is there a way to embed python 3.7 code in D program?

2019-05-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 21:29:18 UTC, Danny Arends wrote: "ImportError: No module named 'stuff'" How do I make the py_import file from pyd find the stuff.py file ? On Linux PYTHONPATH doesn't have current directory by default, so a hacky way to do it is to add it to PYTHONPATH prior to

Re: C Style char**

2019-05-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 09:24:34 UTC, Doug Clayton wrote: Hi All, First time poster :) I'm working on getting a binding to Vulkan working properly in D, but I've run into a roadblock. The good news is that the binding seems to work fine, but I'm having an issue getting a parameter that

Re: is there a way to embed python 3.7 code in D program?

2019-05-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 03:06:07 UTC, evilrat wrote: https://github.com/Superbelko/pyd-min Here. Super minimal example, ptvsd can be commented out as well, it is there entirely for debugging. Pardon me, somehow I was completely misread the original question... Well, maybe someone else

Re: is there a way to embed python 3.7 code in D program?

2019-05-12 Thread evilrat via Digitalmars-d-learn
On Monday, 13 May 2019 at 01:35:58 UTC, evilrat wrote: I have project using pyd with python 3.7, that also using ptvsd (visual studio debugger for python package) to allow mixed debugging right inside VS Code. I'll reduce the code and upload somewhere later.

Re: is there a way to embed python 3.7 code in D program?

2019-05-12 Thread evilrat via Digitalmars-d-learn
On Sunday, 12 May 2019 at 22:36:43 UTC, torea wrote: ok, I'll do some more tests with pyd then. And if I cannot get it to work, I'll have a look at the package! I have project using pyd with python 3.7, that also using ptvsd (visual studio debugger for python package) to allow mixed

Re: OT - Git training Lon/HK and book recommendation on taste in programming

2019-05-01 Thread evilrat via Digitalmars-d-learn
On Wednesday, 1 May 2019 at 09:51:01 UTC, Laeeth Isharc wrote: Second question. Lots of people these days start to program to solve their problems at work but they may never have been shown the basic principles of design, structuring and maintenance of their code. If I could give them one

Re: DLL creation fails with undefined symbol error

2019-04-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 April 2019 at 14:20:24 UTC, dokutoku wrote: Error: linking with LLD failed C:\ldc\bin\ldc2.exe failed with exit code 1. Ok, I have Visual Studio and SDKs installed so it works for me without touching anything else. In your case it is using lld linker instead, and I have no

Re: DLL creation fails with undefined symbol error

2019-04-26 Thread evilrat via Digitalmars-d-learn
On Friday, 26 April 2019 at 05:08:32 UTC, dokutoku wrote: I tried to build a DLL in a Windows 64bit environment. It works well if the compiler is DMD, but in the case of LDC, the build fails with a large number of undefined symbol errors. Is this a DUB or LDC bug? Or do I have to specify some

Re: Recommendations for best JSON lib?

2019-04-20 Thread evilrat via Digitalmars-d-learn
On Saturday, 20 April 2019 at 20:44:22 UTC, Guillaume Piolat wrote: On Saturday, 20 April 2019 at 18:49:07 UTC, Nick Sabalausky (Abscissa) wrote: I only need to read arbitrary JSON data, no need for writing/(de)serialization. std.json is simple as pie. However IIRC it fails with trailing

Re: DlangUI print too small on retina screens

2019-04-13 Thread evilrat via Digitalmars-d-learn
On Saturday, 13 April 2019 at 12:00:30 UTC, Joel wrote: Thanks for the reply, but I looked it up, and couldn't work out what I can do. I want to try using the overrideScreenDPI trick. option 1 - using override DPI function: --- // your average hello world UIAppMain()

Re: DlangUI print too small on retina screens

2019-04-12 Thread evilrat via Digitalmars-d-learn
On Friday, 12 April 2019 at 08:39:52 UTC, Joel wrote: I got a new computer (another MacBook Pro, but this one has retina display), now I don't think I can use my main programs (done in DlangUI), without eye strain and having my head close to the screen. I noticed a lot of forked versions of

Re: use dll's

2019-03-16 Thread evilrat via Digitalmars-d-learn
On Saturday, 16 March 2019 at 15:13:15 UTC, ontrail wrote: On Saturday, 16 March 2019 at 14:18:07 UTC, Andre Pany wrote: On Saturday, 16 March 2019 at 12:53:49 UTC, ontrail wrote: hi, i created a program (windows) and 2 dll's. how do i use the 2 d-language dll's in a d-language program with

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-05 Thread evilrat via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 05:03:42 UTC, Mike Parker wrote: This has nothing to do with dub, so that’s the wrong place for it. The dmd for windows docs needs to make clear the distinction between the linkers and the differences in behavior, and point to the linked docs for options. I just

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread evilrat via Digitalmars-d-learn
On Tuesday, 5 March 2019 at 03:48:22 UTC, Mike Parker wrote: I stopped using WinMain with D a long time ago. It's not necessary. If you always use `main`, then both linkers will provide you with a console subsystem app by default. That's particularly useful during development. You can add a

Re: DUB / compiling same source and config to different windows subsystems in 32/64 bit

2019-03-04 Thread evilrat via Digitalmars-d-learn
On Monday, 4 March 2019 at 18:34:09 UTC, Robert M. Münch wrote: Hi, when compiling a minimal Windows GUI app (using WinMain()) and compiling it with DUB, the 32-bit x86 version is a character subsystem EXE (writeln works) and for x86_64 it's a GUI subsystem EXE (writeln doesn't work). Since

Re: how to pass a malloc'd C string over to be managed by the GC

2019-02-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 28 February 2019 at 04:26:47 UTC, Sam Johnson wrote: Update: it seems that all I need to do is GC.addRoot(output); and memory leak goes away. I think I have answered my own question. If you know what you are doing. Otherwise you just postpone troubles due to mixed

Re: Setup help?

2019-02-06 Thread evilrat via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 23:59:07 UTC, Charles wrote: I don't use C++, and I do use Windows, which has me wondering if I'm just missing some normal/exepcted configuration. My most recent attempt I tried to get Native Debug to make VS Code debugging stop on the first line. Instead,

Re: C++ base class needs at least one virtual method

2019-02-06 Thread evilrat via Digitalmars-d-learn
On Wednesday, 6 February 2019 at 07:38:04 UTC, ezneh wrote: Thanks for the trick, I'll try it and see how it goes. Since the class have nothing in them, I just made some "alias otherclass = baseclass" statements and it seems it is working (at least it's compiling, have to really test that

Re: C++ base class needs at least one virtual method

2019-02-05 Thread evilrat via Digitalmars-d-learn
On Tuesday, 5 February 2019 at 14:23:00 UTC, ezneh wrote: Hello While trying to make a 1:1 binding to a C/C++ lib, I got the following issue: I only have access to the .h header file, and in there I have this: class someclass {}; class otherclass : public someclass {}; When trying to

Re: Is there a nice syntax to achieve optional named parameters?

2019-01-18 Thread evilrat via Digitalmars-d-learn
On Friday, 18 January 2019 at 09:39:31 UTC, John Burton wrote: On Thursday, 17 January 2019 at 01:43:42 UTC, SrMordred wrote: struct Config { string title; int width; } struct Window { this(Config config) It likely is a bad idea for a small struct like this but if it

Re: How may I tell dub where to find a C library for linking?

2018-12-09 Thread evilrat via Digitalmars-d-learn
On Monday, 10 December 2018 at 02:59:21 UTC, Pablo De Nápoli wrote: On my system (Debian GNU/Linux 9, 64 bits) the library is in the directory /usr/lib/llvm-6.0/lib/ $ ls -l /usr/lib/llvm-6.0/lib/libLLVM.so lrwxrwxrwx 1 root root 14 oct 24 19:44 /usr/lib/llvm-6.0/lib/libLLVM.so ->

Re: DirectXMath alternative

2018-12-05 Thread evilrat via Digitalmars-d-learn
On Wednesday, 5 December 2018 at 10:52:44 UTC, Guillaume Piolat wrote: On Wednesday, 5 December 2018 at 01:57:53 UTC, evilrat wrote: On Tuesday, 4 December 2018 at 20:41:54 UTC, Guillaume Piolat wrote: On Tuesday, 4 December 2018 at 20:33:07 UTC, John Burton wrote: What is the best alternative

Re: DirectXMath alternative

2018-12-04 Thread evilrat via Digitalmars-d-learn
On Tuesday, 4 December 2018 at 20:41:54 UTC, Guillaume Piolat wrote: On Tuesday, 4 December 2018 at 20:33:07 UTC, John Burton wrote: What is the best alternative for D, assuming there is anything? (I want vector, matrix math for use in D3, things like inverting a matrix, getting perspective

Re: Importing struct

2018-08-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 August 2018 at 13:09:24 UTC, Andrey wrote: On Monday, 13 August 2018 at 13:05:28 UTC, evilrat wrote: however the best option is simply avoid naming anything with same name as module. Hmm, I thought that name of class should match name of file... And how to name a file that

Re: Importing struct

2018-08-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 August 2018 at 12:44:44 UTC, evilrat wrote: Another option to save up on typing is renamed imports import mc = MyClass; mc.MyClass.parse(...) this also should work import mc = MyClass; alias MyClass = mc.MyClass; // make synonym // now it is just MyClass

Re: Importing struct

2018-08-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 August 2018 at 12:34:25 UTC, Andrey wrote: Hello, This is my test project: source/app.d source/MyClass.d app.d: import std.stdio; import MyClass; void main(string[] args) { MyClass.MyClass.parse(args); // I want just

Re: Windows 64-bit import library

2018-07-20 Thread evilrat via Digitalmars-d-learn
On Friday, 20 July 2018 at 04:31:38 UTC, Jordan Wilson wrote: On Friday, 20 July 2018 at 01:34:39 UTC, Mike Parker wrote: On Thursday, 19 July 2018 at 21:43:35 UTC, Jordan Wilson wrote: Is there any way I can generate the appropriate lib? Else I think I'll need to get hold of the proper

Re: Is there any tool that will auto publish my changes.

2018-07-16 Thread evilrat via Digitalmars-d-learn
On Sunday, 15 July 2018 at 00:25:22 UTC, Venkat wrote: I am writing a simple vibe.d app. The following is what I do right now. - I make changes. - build - Restart the server. Is there any tool that will auto publish my changes as I save them ? I am using Visual Studio Code. Thanks Venkat

Re: how to compile D programs without console window

2018-07-14 Thread evilrat via Digitalmars-d-learn
On Saturday, 14 July 2018 at 09:43:48 UTC, Flaze07 wrote: On Saturday, 14 July 2018 at 09:39:21 UTC, rikki cattermole wrote: If you're using dub, throw them into lflags and remove the -L. https://forum.dlang.org/post/gmcsxgfsfnwllploo...@forum.dlang.org hmm, for some unknown reason it says

Re: Create D binding for C struct containing templated class

2018-06-29 Thread evilrat via Digitalmars-d-learn
On Friday, 29 June 2018 at 06:04:10 UTC, Andre Pany wrote: Thanks a lot for the great help. You are right, until now I haven't looked at the include folder, I thought the "surface" folder is the folder with the public api. But it seems also in the include folder, the header files contains

Re: Create D binding for C struct containing templated class

2018-06-28 Thread evilrat via Digitalmars-d-learn
On Thursday, 28 June 2018 at 18:43:11 UTC, Andre Pany wrote: Hi, I try to write a binding for the GRPC core. There is a struct which has some ugly fields: (https://github.com/grpc/grpc/blob/master/src/core/lib/surface/call.cc#L229) struct grpc_call { gpr_refcount ext_ref; gpr_arena*

Re: Passing C++ class to DLL for callbacks from D (Steam)

2018-06-09 Thread evilrat via Digitalmars-d-learn
On Sunday, 10 June 2018 at 01:35:40 UTC, cc wrote: On Saturday, 9 June 2018 at 14:11:13 UTC, evilrat wrote: However steam devs decided to shield actual pointer and return pointer sized integer when C API is used(or they just screw up?). Anyway, the pointers for subsystems returned by context

Re: Passing C++ class to DLL for callbacks from D (Steam)

2018-06-09 Thread evilrat via Digitalmars-d-learn
On Saturday, 9 June 2018 at 03:14:13 UTC, cc wrote: On Saturday, 9 June 2018 at 03:07:39 UTC, cc wrote: I've put together a simplified test program here (124KB): Here is a pastebin of the D source file updated with some additional comments at the end with the callback class definitions from

Re: Runtime introspection, or how to get class members at runtime Fin D

2018-06-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 June 2018 at 08:06:27 UTC, Arafel wrote: On Thursday, 7 June 2018 at 13:07:21 UTC, evilrat wrote: I don't think so. It clearly states that children must mixin too, which can mean it just grabs symbols in scope only, and base class has no way of knowing about its subclasses. It

Re: Passing C++ class to DLL for callbacks from D (Steam)

2018-06-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 June 2018 at 06:59:51 UTC, cc wrote: On Friday, 8 June 2018 at 02:52:10 UTC, Mike Parker wrote: On Friday, 8 June 2018 at 00:55:35 UTC, cc wrote: class CImpl : CCallbackBase { extern(C++) { If anyone has any insight to provide it would be greatly appreciated, thanks!

Re: Passing C++ class to DLL for callbacks from D (Steam)

2018-06-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 June 2018 at 00:55:35 UTC, cc wrote: I've defined it in D, as per https://dlang.org/spec/cpp_interface.html#classes : change this to class, or even abstract class as shown in example extern(C++) { interface CCallbackBase { //this() { m_nCallbackFlags

Re: Runtime introspection, or how to get class members at runtime Fin D

2018-06-07 Thread evilrat via Digitalmars-d-learn
On Thursday, 7 June 2018 at 12:32:26 UTC, Arafel wrote: Thanks for all the answers! Is it possible to register, say, a base class, and have all the subclasses then registered automatically? My idea would be to make it as transparent as possible for the plugin implementation, and also not

Re: Runtime introspection, or how to get class members at runtime Fin D

2018-06-07 Thread evilrat via Digitalmars-d-learn
On Wednesday, 6 June 2018 at 13:28:02 UTC, Arafel wrote: I know it might not be the most idiomatic D, but as somebody with mostly a Java background (with some C and just a bit of C++) it seems something really straightforward to me: myObject.getClass().getFields() [2]. Also, I know I could

Re: Making an .exe that executes source file inside itself.

2018-04-27 Thread evilrat via Digitalmars-d-learn
On Thursday, 26 April 2018 at 10:06:57 UTC, JN wrote: On Wednesday, 25 April 2018 at 19:19:58 UTC, BoQsc wrote: Alternatively, I don't know about specifics how to implement it in D, but the key phrase you are looking for is "code hotswap" or "hot loading". It's being popularized right now in

Re: Request Assistance Calling D from C++: weird visibility issue inside struct and namespace

2017-11-07 Thread evilrat via Digitalmars-d-learn
On Wednesday, 8 November 2017 at 06:34:27 UTC, Andrew Edwards wrote: Modify example.cpp to: == // example.cpp #include "example.h" namespace SomeApi {} struct SomeStruct {} void call_cpp() { foo("do great things"); return; }

Re: COM/OLE advanced questions

2017-11-02 Thread evilrat via Digitalmars-d-learn
You'd better read some more authorative source since my experience is very limited on that matter, but here is some quick notes On Thursday, 2 November 2017 at 14:22:56 UTC, Guillaume Piolat wrote: Question 1. Is it mandatory to inherit from core.sys.windows.unknwn.IUnknown, or just having

Re: dub optional dependency

2017-10-28 Thread evilrat via Digitalmars-d-learn
On Saturday, 28 October 2017 at 19:23:42 UTC, ikod wrote: So default version is "std", I can build it w/o vibe-d, but dub anyway fetch vibe-d. I'd like dub fetch vibe-d only when I build with --config vibed. I know about "optional": true, it prevent dub to fetch vibe-d for "std" config,

Re: debugging in vs code on Windows

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 07:57:25 UTC, Dmitry wrote: On Tuesday, 17 October 2017 at 10:09:12 UTC, Dmitry wrote: On Tuesday, 17 October 2017 at 08:38:20 UTC, Arjan wrote: Before this will work, one must install the Microsoft C/C++ Addin i.e. ms-vscode.cpptools. Start debugging and

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 08:22:09 UTC, Andrea Fontana wrote: On Wednesday, 18 October 2017 at 03:48:01 UTC, Ky-Anh Huynh wrote: You can write your script in D using #!/usr/local/bin/rdmd as shebang line. Or, using dstep, you can convert C headers to D imports, so you can compile your

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 08:15:53 UTC, evilrat wrote: ... extern(C) static int test_builtin(WORD_LIST* list) ... This of course should be nothrow also, because if it throws something really bad may(will) happen

Re: Writing some built-in functions for Bash, possible?

2017-10-18 Thread evilrat via Digitalmars-d-learn
On Wednesday, 18 October 2017 at 03:48:01 UTC, Ky-Anh Huynh wrote: Hi, I'm using Bash heavily in my systems. Things become slow and slow when I have tons of scripts :) And sometimes it's not easy to manipulate data. You may have heard of recutils [1] which has a C extension to be loaded by

Re: Can't use function with same name as module?

2017-10-17 Thread evilrat via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 06:13:45 UTC, Shriramana Sharma wrote: Hello. fun.d: import std.stdio; void fun() { writeln("Hello"); } main.d: import fun; void main() { fun(); } $ dmd -oftest fun.d main.d main.d(2): Error: function expected before (), not module fun of type void Why can't

Re: How to embed static strings to a D program?

2017-10-16 Thread evilrat via Digitalmars-d-learn
On Monday, 16 October 2017 at 05:34:13 UTC, Ky-Anh Huynh wrote: Hello, I want to use some static contents in my program, e.g, a CSS file, a long listing. To help deployment process I'd like to have them embedded in the final binary file. Is there any convenient way to support this? Maybe I

Re: Why isn't IID_ITaskbarList3 defined?

2017-10-15 Thread evilrat via Digitalmars-d-learn
On Sunday, 15 October 2017 at 15:13:09 UTC, Nieto wrote: I'm trying to write a blinding and I found both IID_ITaskbarList and IID_ITaskbarList2 are defined but IID_ITaskbarList3 isn't. Any reason why it isn't defined? sorry if it sounds such a naive question, I'm new to COM and D interop. I

Re: debugging in vs code on Windows

2017-10-14 Thread evilrat via Digitalmars-d-learn
On Saturday, 14 October 2017 at 07:40:31 UTC, piotrklos wrote: On Friday, 13 October 2017 at 17:04:00 UTC, kerdemdemir wrote: On Friday, 13 October 2017 at 12:55:09 UTC, piotrklos wrote: (...) I am using VisualD(https://github.com/dlang/visuald/releases) with vs2015 community version(free)

Re: C++ binding issues with C++ function returning a simple POD struct.

2017-05-22 Thread evilrat via Digitalmars-d-learn
On Monday, 22 May 2017 at 18:51:43 UTC, ParticlePeter wrote: On Monday, 22 May 2017 at 14:01:56 UTC, Jerry wrote: IIRC the problem is that it isn't a POD type. ImVec2 has its own default constructor. The problem now is that because it no longer is POD, Window's ABI handles it different and

Re: C++ binding issues with C++ function returning a simple POD struct.

2017-05-22 Thread evilrat via Digitalmars-d-learn
On Monday, 22 May 2017 at 11:25:31 UTC, ParticlePeter wrote: Then I am not getting your hack, this function here, does not exist on the C++ side. HACK --- // extern(C++) of course void GetCursorPos(ImVec2* v); How is it supposed to work then if there is no

Re: C++ binding issues with C++ function returning a simple POD struct.

2017-05-22 Thread evilrat via Digitalmars-d-learn
On Monday, 22 May 2017 at 08:03:07 UTC, ParticlePeter wrote: No, no, this (other) way around :-), still C++ to D. It actually works btw: HACK --- // original C++ ImVec2 GetCursorPos(); // C++ helper void GetCursorPos(ImVec2& result) { result = GetCursorPos(); }

Re: C++ binding issues with C++ function returning a simple POD struct.

2017-05-22 Thread evilrat via Digitalmars-d-learn
On Monday, 22 May 2017 at 06:33:37 UTC, ParticlePeter wrote: On Monday, 22 May 2017 at 01:39:04 UTC, evilrat wrote: And this is actually D problem. In fact first bug report on this thing was dated back to 2014. Still not fixed. Thanks for your reply, do you have any links to some bug

Re: C++ binding issues with C++ function returning a simple POD struct.

2017-05-21 Thread evilrat via Digitalmars-d-learn
On Monday, 22 May 2017 at 01:27:22 UTC, Nicholas Wilson wrote: On Sunday, 21 May 2017 at 19:33:06 UTC, ParticlePeter wrote: I am statically linking to ImGui [1] on Win 10 x64, quite successfully till this issue came up. The noticed error so far comes when an ImGui function returns an ImVec2, a

Re: Top level associative arrays

2017-05-02 Thread evilrat via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 09:50:50 UTC, ANtlord wrote: On Tuesday, 2 May 2017 at 08:24:09 UTC, evilrat wrote: Making enum means that value should be available at compile time and AA's are fully dynamic. But if my memory serves me well, you can declare empty AA and delay initialization. So

Re: Top level associative arrays

2017-05-02 Thread evilrat via Digitalmars-d-learn
On Tuesday, 2 May 2017 at 07:48:35 UTC, ANtlord wrote: Hello! Is it possible to define associative array on top level of module? I try to compile this code and I get message `Error: non-constant expression ["s":"q", "ss":"qq"]` import std.stdio; auto dict = [ "s": "q", "ss":

Re: Single exe vibe.d app

2017-04-05 Thread evilrat via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote: Hi, How can I build single exe application with vibe.d (windows)? now it require zlib.dll, libeay32.dll and ssleay32.dll But I need it as single app. btw, if all you need is to ship it as a single file and don't care if it writes

Re: Single exe vibe.d app

2017-04-05 Thread evilrat via Digitalmars-d-learn
On Wednesday, 5 April 2017 at 12:13:38 UTC, Satoshi wrote: Hi, How can I build single exe application with vibe.d (windows)? now it require zlib.dll, libeay32.dll and ssleay32.dll But I need it as single app. you have to build those as static libraries first, compile vibe.d with that static

Re: COM2D Wrapper

2017-03-27 Thread evilrat via Digitalmars-d-learn
On Monday, 27 March 2017 at 21:02:05 UTC, Nierjerson wrote: On Friday, 24 March 2017 at 18:17:31 UTC, Nierjerson wrote: I'd like to present the following D library I am working on: https://github.com/IllusionSoftware/COM2D I get access violations when trying to call the functions on the

Re: How to COM interfaces work

2017-03-18 Thread evilrat via Digitalmars-d-learn
On Sunday, 19 March 2017 at 03:27:28 UTC, StarGrazer wrote: I'd just like to get some conformation on the process so at least I know I'm headed in the right direction. The project is pretty complex and most of the stuff is done in compile time code. What debug shows? If CoCreateInstance

Re: How to COM interfaces work

2017-03-18 Thread evilrat via Digitalmars-d-learn
On Sunday, 19 March 2017 at 02:04:53 UTC, StarGrazer wrote: I have a COM interface that is dynamically created using invoke and such. One of the functions returns an interface. It is just a value of IUnknown or whatever. If I use it as a pointer in to the the D interface equivalent, it

Re: Declaring interfaces with a constructor

2017-03-14 Thread evilrat via Digitalmars-d-learn
On Tuesday, 14 March 2017 at 13:54:41 UTC, David Zhang wrote: Yeah, that's the idea. Though I just thought of a possibility using an isPublicInterface template. Is that what you meant by templates and duck typing? Not sure about what that template does, but the idea behind ranges is

Re: Declaring interfaces with a constructor

2017-03-13 Thread evilrat via Digitalmars-d-learn
On Monday, 13 March 2017 at 19:31:52 UTC, David Zhang wrote: Basically, I want to define a common interface for a group of platform-specific classes, except that they should ideally also share constructor parameters. What I want to do is then alias them to a common name, selecting the

Re: DMD + Dynamic Library.

2017-03-08 Thread evilrat via Digitalmars-d-learn
On Wednesday, 8 March 2017 at 18:21:35 UTC, Damien Gibson wrote: On Wednesday, 8 March 2017 at 06:28:47 UTC, Jerry wrote: You have to use "export" for any symbol to be visible from a dll. On Windows by default nothing is exported. Would "export" and "export extern(D):" not be the same? Im

Re: Recommend: IDE and GUI library

2017-03-01 Thread evilrat via Digitalmars-d-learn
On Wednesday, 1 March 2017 at 23:44:47 UTC, XavierAP wrote: For this I found out how to clone the dependencies, sorry about that... (Only from the command line... Anyone recommends better free Windows Git gui clients than GitHub Desktop?) TortoiseGIT maybe?

Re: Recommend: IDE and GUI library

2017-02-24 Thread evilrat via Digitalmars-d-learn
On Saturday, 25 February 2017 at 00:45:24 UTC, Moritz Maxeiner wrote: I use Visual Studio Code on Linux and macOS, not sure how the experience on Windows is, but I'd expect it to be the same. Windows is fine, can also debug mscoff x86 or x64 projects with MS 'cpptools' plugin that has

Re: Why is for() less efficient than foreach?

2017-02-10 Thread evilrat via Digitalmars-d-learn
On Friday, 10 February 2017 at 13:13:24 UTC, evilrat wrote: On my machine (AMD FX-8350) actually almost no difference oops, it skips flags with -run -_- sorry dmd loops.d -release Function 0 took: 16 ╬╝s and 5 hnsecs Function 1 took: 55 secs, 262 ms, 844 ╬╝s, and 6 hnsecs Function 2 took:

Re: Why is for() less efficient than foreach?

2017-02-10 Thread evilrat via Digitalmars-d-learn
On Friday, 10 February 2017 at 12:39:50 UTC, Bastiaan Veelo wrote: Depending on the machine this is run on, for() performs a factor 3-8 slower than foreach(). Can someone explain this to me? Or, taking for() as the norm, how can foreach() be so blazingly fast? Thanks! On my machine (AMD

Re: How do I call a C++ struct default constructor from D?

2017-02-08 Thread evilrat via Digitalmars-d-learn
On Tuesday, 7 February 2017 at 14:26:11 UTC, MGW wrote: On Tuesday, 7 February 2017 at 13:37:01 UTC, Atila Neves wrote: Here still example https://pp.vk.me/c636630/v636630885/46579/neSdIip1ySI.jpg I'm sorry for being offensive, but... Of course, and the next step will be pragma mangle on D

Re: Are there plans to make mono D work with current version?

2017-01-25 Thread evilrat via Digitalmars-d-learn
On Thursday, 26 January 2017 at 01:58:51 UTC, Adam Wilson wrote: I'd recommend VSCode with Code-D works very well for me. https://github.com/Pure-D/code-d And with Microsoft C++ tools (ms-vscode.cpptools) it can debug D too with x64 or -m32mscoff

Re: returning struct, destructor

2016-12-21 Thread evilrat via Digitalmars-d-learn
On Wednesday, 21 December 2016 at 14:15:06 UTC, John C wrote: On Wednesday, 21 December 2016 at 11:45:18 UTC, Eugene Wissner wrote: This prints 3 times "Destruct" with dmd 0.072.1. If I remove the if block, it prints "Destruct" only 2 times - the behavior I'm expecting. Why? Possibly to do

D3D12 memory issues

2016-12-20 Thread evilrat via Digitalmars-d-learn
Hello guys, I have DirectX 12 code that doesn't work in D (it works in C++), as the subject says this can be related to D heap and/or thread local storage. code can be found here (build with dmd -m32mscoff)

Re: Is it possbile to specify a remote git repo as dub dependency?

2016-12-20 Thread evilrat via Digitalmars-d-learn
On Tuesday, 20 December 2016 at 11:04:30 UTC, biocyberman wrote: On Monday, 19 December 2016 at 16:23:45 UTC, Guillaume Piolat wrote: What you can do for private package as of today is: - use path-based dependencies and put your packages in the same repo - use git submodules and

  1   2   >