Re: KQueue and Fibers

2021-04-09 Thread Jacob Carlborg via Digitalmars-d-learn
0].filter & EVFILT_READ); ``` The `filter` field of an event is not a flag/bit field. It's just a plain value, you should use `==` to check if it's a read event. I'm not sure if fixing these things will solve your issue. But at least some problems I noticed. -- /Jacob Carlborg

Re: Gui toolkits alive and gui toolkits dead

2021-04-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2021-04-06 21:57, Alain De Vos wrote: Can we say tk ang gtk toolkits are alive. But wxwidgets , fox an fltk are dead ? Do you mean these libraries in general or D bindings to these libraries? -- /Jacob Carlborg

Re: Contributing CDF bindings to Deimos

2021-03-31 Thread Jacob Carlborg via Digitalmars-d-learn
ere in the learn forum or on the DStep specific discussions section (which I just enabled) on GitHub [2]. I'll do my best to help you. [1] https://github.com/jacob-carlborg/dstep [2] https://github.com/jacob-carlborg/dstep/discussions -- /Jacob Carlborg

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-17 Thread Jacob Carlborg via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 15:16:36 UTC, Jacob Carlborg wrote: macOS doesn't support static linking. The proper way to solve this is to bundle the dynamic libraries with the application. If it's a GUI application it can be located in the application bundle. It seems like Dav

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-17 Thread Jacob Carlborg via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 13:52:48 UTC, Guillaume Piolat wrote: On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote: Anyone else done this? Pointers welcome. Sorry for delay. Just add "dflags-osx-ldc": ["-static"], macOS doesn't support static linking. -- /Jacob Carlborg

Re: lockstep works with .each, but fails with .map

2021-03-05 Thread Jacob Carlborg via Digitalmars-d-learn
`lockstep`. -- /Jacob Carlborg

Re: ldc on a raspberry pi 3 running freebsd

2021-02-26 Thread Jacob Carlborg via Digitalmars-d-learn
On 2021-02-23 16:34, Decabytes wrote: ldc2 is the winner thank you! I'd like to get gdc and dmd up and running to at some point Unfortunately, DMD doesn't support ARM. -- /Jacob Carlborg

Re: How can I get this UDA at compile time?

2021-02-21 Thread Jacob Carlborg via Digitalmars-d-learn
his, to get something a bit closer to your original example: // add this to the Foo struct static Proxy attributes() { return Proxy(); } struct Proxy { string opDispatch(string name)() { return __traits(getAttributes, mixin("Foo.", name))[0].value; } } void main() { writeln(Foo.attributes.a); } -- /Jacob Carlborg

Re: Type of string literal concatenated with non-immutable char array

2021-02-01 Thread Jacob Carlborg via Digitalmars-d-learn
].a == 3); } Due to language consistency it should behave the same for all types. In the above example, `c` is typed as `const(Foo)[]`. Although, I wonder why in your example the concatenation is typed as `char[]` instead of `const(char)[]`. Perhaps that's a bug. -- /Jacob Carlborg

Re: Why are multiple instances of the single enum created?

2021-02-01 Thread Jacob Carlborg via Digitalmars-d-learn
e for numeric values, strings, characters and similar values. Why waste extra space on a variable if it's not needed? If you don't want a new instance, then don't use `enum`. Use `immutable` instead. -- /Jacob Carlborg

Re: std.expreimantal.allocator deallocate

2021-01-25 Thread Jacob Carlborg via Digitalmars-d-learn
g `typeid(base).initializer.length`. Base base = new Derived; assert(__traits(classInstanceSize, Derived) == typeid(base).initializer.length); -- /Jacob Carlborg

Re: [Understanding] Classes and delegate inheritance vs function pointers

2021-01-09 Thread Jacob Carlborg via Digitalmars-d-learn
nd of like reference types. They consist of a context pointer and a function pointer. Function pointer are, as the name suggest, already pointers. -- /Jacob Carlborg

Re: DConf talk : Exceptions will disappear in the future?

2021-01-07 Thread Jacob Carlborg via Digitalmars-d-learn
. But interestingly, the occurrence of this is much more seldom than checking the return value after each function. It's claimed that exceptions are not zero cost, even when an exception is not thrown. Because the compiler cannot optimize functions that may throw as well as those that cannot throw.

Re: DConf talk : Exceptions will disappear in the future?

2021-01-07 Thread Jacob Carlborg via Digitalmars-d-learn
ne that throws a static exception (and vice versa); each is translated to the other automatically by default or you can do it explicitly if you prefer." But perhaps you're proposing something different for D? -- /Jacob Carlborg

Re: dmd 2.093.1: duplicate method definitions ignored altogether

2021-01-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2021-01-05 03:02, kdevel wrote: expected output: none. The compiler should have rejected the code after the duplicate definition def #2. dmd 2.093.1 ignores both definitions instead. Is this a bug or a bug? DMD 2.095.0 now reports an error for this. -- /Jacob Carlborg

Re: How to store a pointer to class contructor

2020-12-25 Thread Jacob Carlborg via Digitalmars-d-learn
as well to store different values of different types. But then everything need to be known at compile time. That is, the index, in your case. -- /Jacob Carlborg

Re: extern(C) and name mangling

2020-12-16 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-12-16 16:18, Dave P. wrote: Is this a bug in the spec or in the implementation? Yeah, that's a good question. That's always problematic with D. The spec is incomplete. How do we get this fixed? The simplest would be to change the spec. -- /Jacob Carlborg

Re: extern(C) and name mangling

2020-12-15 Thread Jacob Carlborg via Digitalmars-d-learn
r)`. That function needs to have C calling convention. But to avoid any conflicts with other `extern(C)` functions I wanted to keep the D mangling. https://github.com/dlang/druntime/blob/master/src/core/memory.d#L212-L232 -- /Jacob Carlborg

Re: extern(C) and name mangling

2020-12-15 Thread Jacob Carlborg via Digitalmars-d-learn
struct is passed, on some it doesn't. -- /Jacob Carlborg

Re: extern(C) and name mangling

2020-12-15 Thread Jacob Carlborg via Digitalmars-d-learn
mangling to get the same name as the C function void foo(int a, int b); // D calling convention void main() { foo(1, 2); } $ clang -o foo.o foo.c -c $ dmd main.d foo.o $ ./main a=2 b=1 LDC behaves the same way as DMD and, IIRC, GDC follows how GCC passes the arguments. -- /Jacob Carlborg

Re: Hex constant method starts from ".a": 0xCCCCCC.argb

2020-12-14 Thread Jacob Carlborg via Digitalmars-d-learn
eauty! Or you can call it `rgba`. It seems to be what Wikipedia prefers [1]. [1] https://en.wikipedia.org/wiki/RGBA_color_model -- /Jacob Carlborg

Re: Request assistance initializing struct instance at global scope

2020-12-08 Thread Jacob Carlborg via Digitalmars-d-learn
lang.org/phobos/core_runtime.html#.rt_term -- /Jacob Carlborg

Re: Request assistance initializing struct instance at global scope

2020-12-07 Thread Jacob Carlborg via Digitalmars-d-learn
or another file) is to mangle the function name the same way as a D function. You can either use `extern(C) char*[] hldr` to make only `hldr` have C linkage. Use `extern(C) {}` to group several symbols which should have C linkage or rearrange the code so that `static this` is above `exte

Re: Ways to parse D code.

2020-11-26 Thread Jacob Carlborg via Digitalmars-d-learn
he same code as the compiler is using. Here's an example on how to use DMD to parse some code [1]. Here's some more advance usages [2]. [1] https://github.com/dlang/dmd/blob/b35572b07a6994385b6459a430674d32e9a97279/test/dub_package/frontend.d#L10-L24 [2] https://github.com/jacob-carlbo

Re: How can I convert Hexadecimal to RGB Color and vice-versa?

2020-11-24 Thread Jacob Carlborg via Digitalmars-d-learn
value <= 255) // assert that the value is within bounds { hex = (hex & 0x00) | value; } string toString() { return format!"Color(red: %s, green: %s, blue: %s)"(red, green, blue); } } void main() { Color color; color.red = 255; color.green = 143; color.blue = 89; writeln(color); } -- /Jacob Carlborg

Re: betterC question

2020-11-19 Thread Jacob Carlborg via Digitalmars-d-learn
= 255; assert(color.red == 255); } [1] https://en.wikipedia.org/wiki/Property_(programming) -- /Jacob Carlborg

Re: question as to when a new command gets executed

2020-11-10 Thread Jacob Carlborg via Digitalmars-d-learn
( )     {     }     // rest of class } It gets executed at compile time. All instances of `DebuggerSession` will share the same single instance of `BreakState`. -- /Jacob Carlborg

Re: How add class or struct member after construction?

2020-11-08 Thread Jacob Carlborg via Digitalmars-d-learn
; } void printA(Foo foo) { writeln(foo.a); } foo.printA(); printA(foo); The two above lines are exactly the same. [1] https://dlang.org/spec/function.html#pseudo-member -- /Jacob Carlborg

Re: DMD: invalid UTF character `\U0000d800`

2020-11-08 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-11-08 13:39, Kagamin wrote: Surrogate pairs are used in rules because java strings are utf-16 encoded, it doesn't make much sense for other encodings. D supports the UTF-16 encoding as well. The compiler doesn't accept the surrogate pairs even for UTF-16 strings. -- /Jacob Carlborg

Re: DMD: invalid UTF character `\U0000d800`

2020-11-07 Thread Jacob Carlborg via Digitalmars-d-learn
ing UTF-16, can encode these code points" [1]. "... the standard states that such arrangements should be treated as encoding errors" [1]. Perhaps they need to be combined with other code points to form a valid character. [1] https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF -- /Jacob Carlborg

Re: why `top` report is not consistent with the memory freed by core.stdc.stdlib : free?

2020-11-06 Thread Jacob Carlborg via Digitalmars-d-learn
he memory just as the GC does for efficiency, even if `free` is called. Otherwise it would be not much point in using over the syscalls like `mmap` or `sbrk` (and whatever the corresponding calls are on Windows). -- /Jacob Carlborg

Re: Does dmd's -i "include imported modules in the compilation" switch generate object files?

2020-11-04 Thread Jacob Carlborg via Digitalmars-d-learn
** passed, it will produce one executable and one single object file. -- /Jacob Carlborg

Re: synthesising instantiated template parameters and arguments

2020-10-29 Thread Jacob Carlborg via Digitalmars-d-learn
Are you looking for `TemplateArgsOf` [1] ? [1] https://dlang.org/phobos/std_traits.html#TemplateArgsOf -- /Jacob Carlborg

Re: Dynamic Template-Expansion of (Token) Strings

2020-10-27 Thread Jacob Carlborg via Digitalmars-d-learn
he [1]. Here's a Dub package [2]. [1] http://mustache.github.io/mustache.5.html [2] https://code.dlang.org/packages/mustache-d -- /Jacob Carlborg

Re: this T / variadic template and interfaces

2020-10-27 Thread Jacob Carlborg via Digitalmars-d-learn
to wrap each argument in Variant The advantage of using the type safe variadic function is that all the arguments are bundle into one array, make it easier to work with. -- /Jacob Carlborg

Re: this T / variadic template and interfaces

2020-10-26 Thread Jacob Carlborg via Digitalmars-d-learn
g.org/spec/function.html#d_style_variadic_functions [2] https://dlang.org/spec/function.html#typesafe_variadic_functions -- /Jacob Carlborg

Re: Template pattern delegate?

2020-10-26 Thread Jacob Carlborg via Digitalmars-d-learn
ocate GC memory I think. If you pass the delegate as a template parameter/alias parameter, it's more likely to be inlined: auto myStuff(alias fn)() { try return fn(); catch (Exception e) { } } myStuff!( { /* some code */ } ); -- /Jacob Carlborg

Re: Can we do compile time reading part of a file using import?

2020-10-26 Thread Jacob Carlborg via Digitalmars-d-learn
On Sunday, 25 October 2020 at 16:50:09 UTC, Jack wrote: Which build tool are you refering to? an existing one or build one oneself to do this job? It should work with any build tool that has hooks to execute arbitrary commands. -- /Jacob Carlborg

Re: Two ways of receiving arrays on the C ABI

2020-10-25 Thread Jacob Carlborg via Digitalmars-d-learn
hange the ABI for passing D arrays and this would break. If fact, the ABI documentation [1] doesn't mention how a D array is passed. A different compiler could choose to pass it differently. [1] https://dlang.org/spec/abi.html#arrays -- /Jacob Carlborg

Re: Can we do compile time reading part of a file using import?

2020-10-25 Thread Jacob Carlborg via Digitalmars-d-learn
s and read one of the smaller files with the import expression. -- /Jacob Carlborg

Re: Druntime without pthreads?

2020-10-21 Thread Jacob Carlborg via Digitalmars-d-learn
eld. [1] https://dlang.org/spec/abi.html#classes [2] https://dlang.org/spec/class.html#synchronized-classes [3] https://dlang.org/spec/statement.html#synchronized-statement -- /Jacob Carlborg

Re: Escape this in pure members

2020-09-22 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-19 21:50, Per Nordlöw wrote: On Saturday, 19 September 2020 at 18:48:31 UTC, Jacob Carlborg wrote: A nested class seems to be able to escape the `this` reference: Ahh, thanks. I just realized that it can escape into other parameters without the `scope` qualifier? This class

Re: Escape this in pure members

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
r is just another argument passed to the function. In the struct and class case? A nested class seems to be able to escape the `this` reference: class Foo { Bar b; class Bar { void bar() pure { b = this; } } } -- /Jacob Carlborg

Re: Good repos to learn D

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
rm` packages. Then it provides a common interface that is used by the rest of the project. * Ocean [3]. This one is quite large as well. [1] https://github.com/d-widget-toolkit/dwt [2] https://github.com/weka-io/mecca [3] https://github.com/sociomantic-tsunami/ocean -- /Jacob Carlborg

Re: DDoc generation

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
terate all HTML files and output a simple index.html file. [1] https://github.com/rejectedsoftware/ddox#generating-offline-documentation -- /Jacob Carlborg

Re: DDoc generation

2020-09-19 Thread Jacob Carlborg via Digitalmars-d-learn
unit tests and Ddoc are the best things that have happened since sliced bread. But if you compare with C or C++ the bar isn't very high. -- /Jacob Carlborg

Re: Question about linker errors when using slices

2020-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
ank you in advance for your time! You should compile both files. I'm guessing LDC might be doing some form of optimization to figure out that it doesn't need those symbols. PS: I hope this is the right sub-forum for asking this sort of question! Yes. -- /Jacob Carlborg

Re: Proper way to exit with specific exit code?

2020-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
w return back to the `main` function. -- /Jacob Carlborg

Re: DDoc generation

2020-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
generated documentation. There's no built-in support for that. You might want to look at some other doc generating tool if those support that. -- /Jacob Carlborg

Re: get element index when using each!(x)

2020-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
t; writeln(index, ":", value)); https://dlang.org/phobos/std_algorithm_iteration.html#.each -- /Jacob Carlborg

Re: Neater "not version (...)" ?

2020-09-18 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-09-16 21:04, Vladimirs Nordholm wrote: Ah, I guess it boils down to this then. Doesn't really make it "neater", but thank you for the tip! You only need to declare the enums ones. -- /Jacob Carlborg

Re: Neater "not version (...)" ?

2020-09-16 Thread Jacob Carlborg via Digitalmars-d-learn
; else enum windows = false; static if (!windows) { // ... my code } -- /Jacob Carlborg

Re: tupleof seems to break encapsulation

2020-09-06 Thread Jacob Carlborg via Digitalmars-d-learn
ethod that allows to take full control of the (de)serialization of a specific type. Thirdly, you can do the same thing with pointer arithmetic. Although this is not allowed if @safe code. [1] https://github.com/jacob-carlborg/orange -- /Jacob Carlborg

Re: tupleof seems to break encapsulation

2020-09-04 Thread Jacob Carlborg via Digitalmars-d-learn
r serialization and, as you can see in your example, for debugging as well. `writeln` will print the values of the fields in a struct, even for private fields. -- /Jacob Carlborg

Re: Install multiple executables with DUB

2020-09-03 Thread Jacob Carlborg via Digitalmars-d-learn
ns [1]. Or if you have executables depending on only one source file, you can use single-file packages [2]. Here are some real-world examples [3][4]. [1] https://dub.pm/package-format-sdl.html#configurations [2] https://dub.pm/advanced_usage.html [3] https://github.com/jacob-carlborg/dstep/blob/m

Re: Install multiple executables with DUB

2020-09-03 Thread Jacob Carlborg via Digitalmars-d-learn
to override the source directory. To override the output directory you can use `targetPath` build setting. They are documented here [1][2]. [1] For the SDL format: https://dub.pm/package-format-sdl.html#build-settings [2] For the JSON format: https://dub.pm/package-format-json.html#build-setti

Re: Installing D on Fresh Windows 10 machine is a pain

2020-08-28 Thread Jacob Carlborg via Digitalmars-d-learn
On Friday, 28 August 2020 at 05:38:59 UTC, novice3 wrote: DMD x86 on Windows have no dependencies, just unpack .zip and use. It's a pitty, that DMD x64 depend on VS :( It does not. If VS is not installed the MinGW provided libraries, which are bundled, will be used. -- /Jacob Carlborg

Re: How does D's templated functions implementation differ from generics in C#/Java?

2020-08-08 Thread Jacob Carlborg via Digitalmars-d-learn
o give the best of both worlds. Little binary bloat and high performance. -- /Jacob Carlborg

Re: How does D's templated functions implementation differ from generics in C#/Java?

2020-08-08 Thread Jacob Carlborg via Digitalmars-d-learn
is also most likely the reason why Java generic types don't accept primitive types. They need to be boxed, i.e. `int` need to be wrapped in an object of type `Integer`. -- /Jacob Carlborg

Re: Invoking the compiler during runtime

2020-08-05 Thread Jacob Carlborg via Digitalmars-d-learn
u can start with that at least. -- /Jacob Carlborg

Re: Using D within a rust codebase

2020-07-28 Thread Jacob Carlborg via Digitalmars-d-learn
don't think the first thing to try is to replace the Rust main function with a D main function. -- /Jacob Carlborg

Re: Using D within a rust codebase

2020-07-27 Thread Jacob Carlborg via Digitalmars-d-learn
[2] https://dlang.org/phobos/core_runtime.html#.rt_term -- /Jacob Carlborg

Re: Question about publishing a useful function I have written

2020-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-07-14 23:58, Cecil Ward wrote: What’s the best way to publish a D routine ? As others have already said, on GitHub. Then as a Dub package as well [1]. [1] https://code.dlang.org -- /Jacob Carlborg

Re: misc questions about a DUB package

2020-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
for more information: https://semver.org -- /Jacob Carlborg

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

2020-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
of Clang, I think zoujiaqing is using a Mac. On Mac libc++ is used. That above might not apply. -- /Jacob Carlborg

Re: Choosing a non-default linker for dmd (via dub)

2020-07-15 Thread Jacob Carlborg via Digitalmars-d-learn
to select which C compiler is used. Is there any equivalence for selecting the linker, "LD" perhaps? -- /Jacob Carlborg

Re: App/lib config system

2020-07-09 Thread Jacob Carlborg via Digitalmars-d-learn
On Thursday, 9 July 2020 at 06:57:22 UTC, Kagamin wrote: If you suspect there's a contradiction in requirements, you need to specify them with better precision. What are the contradictions in the requirements? I don't see any. -- /Jacob Carlborg

App/lib config system

2020-07-08 Thread Jacob Carlborg via Digitalmars-d-learn
possible. Does anyone have a system like this that is already available? -- /Jacob Carlborg

Re: How can I make DMD stop on the first fatal error? (-Wfatal-errors)

2020-07-07 Thread Jacob Carlborg via Digitalmars-d-learn
. -- /Jacob Carlborg

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-07 Thread Jacob Carlborg via Digitalmars-d-learn
On Tuesday, 7 July 2020 at 12:41:23 UTC, Per Nordlöw wrote: What about construction and assignment from a static array of `Pair`'s? Wouldn't that be easier on the compiler? I you refer to it wouldn't be using templates, then yes, I guess so. -- /Jacob Carlborg

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Jacob Carlborg via Digitalmars-d-learn
ook pretty: import std; struct Pair { string key; int value; } void main() @nogc { auto a = tuple(Pair("foo", 1), Pair("bar", 2)); } -- /Jacob Carlborg

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 6 July 2020 at 01:43:43 UTC, user1234 wrote: --- import std; struct AA { void opIndexAssign(int v, string k) @nogc {} } void main(string[] args) @nogc { AA myCustom; enum literal = ["one":1, "two":2].stringof[1..$-1]; enum pairs = literal.split(',').array;

Re: Construct an used-defined hash table container type from an AA-literal expression

2020-07-06 Thread Jacob Carlborg via Digitalmars-d-learn
$-1]; enum pairs = literal.split(',').array; --- That split won't work if you have something more complicated, like struct values: struct Foo { int a; int b; } enum literal = ["one":Foo(1, 2), "two":Foo(3, 4)].stringof[1..$-1]; enum pairs = literal.split(',').array; static assert(pairs == 4); -- /Jacob Carlborg

Re: Print only part of a stack trace

2020-07-01 Thread Jacob Carlborg via Digitalmars-d-learn
re_runtime.html#.Runtime.traceHandler -- /Jacob Carlborg

Re: Calling C functions

2020-06-30 Thread Jacob Carlborg via Digitalmars-d-learn
sure there are other differences in the ABIs. -- /Jacob Carlborg

Re: Calling C functions

2020-06-29 Thread Jacob Carlborg via Digitalmars-d-learn
n (C) void foo_extern_c(int, int); void main() { foo_extern_d(1, 2); foo_extern_c(1, 2); } $ dmd main.d foo.o $ ./main a=2 b=1 a=1 b=2 This is on macOS. -- /Jacob Carlborg

Re: Calling C functions

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
o, of course not. How would you otherwise call your `cfunc` function from your original example ;) -- /Jacob Carlborg

Re: Downloading files over TLS

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
gt; bytes function too but I don't remember what it is. Regardless, the Windows functions may look familiar if you have done AJAX - that was based on an IE object which was based on the Windows API. Thanks, I'll take a look. -- /Jacob Carlborg

Re: Downloading files over TLS

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
issue assuming libcurl is built with the platform provided TLS implementation. Just make sure it's possible to statically link libcurl, without using `dlopen`. -- /Jacob Carlborg

Re: Downloading files over TLS

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
32/winhttp/about-winhttp I'll take a look, thanks. -- /Jacob Carlborg

Re: Downloading files over TLS

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
ing on Windows either. macOS is my main platform. Bottom line - problem with SSL/TLS libraries lies in incompatibility between platforms and even inside the single library. Yes. I'm trying to identify the best solution, which ideally requires the least amount of work. [1] https://git

Downloading files over TLS

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
[5] https://developer.apple.com/documentation/security/secure_transport [6] https://developer.apple.com/documentation/network [7] https://developer.apple.com/documentation/foundation/nsurlsession [8] https://code.dlang.org/packages/botan -- /Jacob Carlborg

Re: Calling C functions

2020-06-26 Thread Jacob Carlborg via Digitalmars-d-learn
.)(Args args) { return printf(args); } } void main() { printf("asd\n".ptr); } The `printf` function can be called from anywhere within the module, but not outside the module. -- /Jacob Carlborg

Re: How to correctly integrate D library to Swift/Obj-C mobile project?

2020-06-24 Thread Jacob Carlborg via Digitalmars-d-learn
ting `extern(C)` functions in the D code, which forwards to your D functions (or have the functions being `extern(C)` to begin with). Then you need to have these declarations available in a C header file, either created by using the `-HC` flag or by manually writing the declarations. -- /Jacob Carlborg

Re: How to correctly integrate D library to Swift/Obj-C mobile project?

2020-06-24 Thread Jacob Carlborg via Digitalmars-d-learn
On Monday, 22 June 2020 at 19:41:22 UTC, Vlad wrote: Is it even possible to compile D for iOS and use it the same way as compiled C++ static library? (We do need a D runtime) Yes, druntime/Phobos will need to be linked like any other static library. -- /Jacob Carlborg

Re: Some questions about strings

2020-06-22 Thread Jacob Carlborg via Digitalmars-d-learn
ating null character -- /Jacob Carlborg

Re: Dub Error Message "Invalid variable: DUB"

2020-06-07 Thread Jacob Carlborg via Digitalmars-d-learn
environment variable named "DUB" available to the build script. It should contain the path to the Dub executable. I guess that somehow fails. Might be some unexpected character in the path? -- /Jacob Carlborg

Re: Objective C protocols

2020-05-17 Thread Jacob Carlborg via Digitalmars-d-learn
ot;); override Foo init() @selector("init"); void print(int value) @selector("print:") { writeln(value); } } extern (Objective-C) void print(Printer); void main() { auto foo = Foo.alloc.init; print(cast(Printer) cast(void*) foo); // need to cast through void* } -- /Jacob Carlborg

Re: Get unknown symbol (struct, method, class) tagged with User Defined Attributes

2020-05-13 Thread Jacob Carlborg via Digitalmars-d-learn
system about your symbols. I think it's possible to implement the `RTInfo` template in `object.d`. But that requires a custom druntime. `RTInfo` is a template that is instantiated once for each type in the program. -- /Jacob Carlborg

Re: D and Async I/O

2020-05-12 Thread Jacob Carlborg via Digitalmars-d-learn
/sync/future.d#L23 -- /Jacob Carlborg

Re: Error running concurrent process and storing results in array

2020-05-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-07 02:17, data pulverizer wrote: What is the difference between -O2 and -O3 ldc2 compiler optimizations? `--help` says -O2 is "Good optimizations" and -O3 "Aggressive optimizations". Not very specific. -- /Jacob Carlborg

Re: D and Async I/O

2020-05-11 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-11 16:44, Russel Winder wrote: Crickey, a third option. This wil increase my dithering! ;-) Forth: Mecca [1] :) [1] https://github.com/weka-io/mecca -- /Jacob Carlborg

Re: Error running concurrent process and storing results in array

2020-05-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-06 12:23, data pulverizer wrote: Yes, I'll do a blog or something on GitHub and link it. It would be nice if you could get it published on the Dlang blog [1]. One usually get paid for that. Contact Mike Parker. [1] https://blog.dlang.org -- /Jacob Carlborg

Re: Retrieve the return type of the current function

2020-05-06 Thread Jacob Carlborg via Digitalmars-d-learn
std.traits : ReturnType; alias R = ReturnType!(mixin(caller)); static assert(is(R == int)); } int bar() { foo(); return 0; } -- /Jacob Carlborg

Re: Error running concurrent process and storing results in array

2020-05-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-06 06:04, Mathias LANG wrote: In general, if you want to parallelize something, you should aim to have as many threads as you have cores. That should be _logical_ cores. If the CPU supports hyper threading it can run two threads per core. -- /Jacob Carlborg

Re: Error running concurrent process and storing results in array

2020-05-06 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-05-06 08:54, drug wrote: Do you try `--fast-math` in ldc? Don't know if 05 use this flag Try the following flags as well: `-mcpu=native -flto=full -defaultlib=phobos2-ldc-lto,druntime-ldc-lto` -- /Jacob Carlborg

Re: Error running concurrent process and storing results in array

2020-05-06 Thread Jacob Carlborg via Digitalmars-d-learn
checks physical cores instead of logical cores. That could be a reason, if you're running macOS. -- /Jacob Carlborg

Re: DConf 2017 Videos

2020-04-25 Thread Jacob Carlborg via Digitalmars-d-learn
how to D as Better C could solve that. I think it was the second talk in this list: https://dconf.org/2017/schedule/ Any idea? I have previously downloaded the DConf videos. I sent them to Mike for him to upload. -- /Jacob Carlborg

Re: Array fill performance differences between for, foreach, slice

2020-03-31 Thread Jacob Carlborg via Digitalmars-d-learn
Standard Deviation: 24.5672 For: Mean time(usecs): 40.02, Standard Deviation: 7.67388 -- /Jacob Carlborg

Re: A question about C++ interop

2020-03-28 Thread Jacob Carlborg via Digitalmars-d-learn
ed-up C library through D, it will work fine. So what am I doing wrong here? Thanks! Classes in D are always passed by reference. Try dropping the pointer in the `create` method: static A create(); -- /Jacob Carlborg

  1   2   3   4   5   6   7   8   9   10   >