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

2018-06-10 Thread cc via Digitalmars-d-learn
On Sunday, 10 June 2018 at 02:57:34 UTC, evilrat wrote: Only subsystems getters like SteamUser() or SteamInventory() requires wrapping. I really can't understand why they ever choose to silently ignore registering callbacks received with C API systems handles... Thanks to the information

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

2018-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2018 10:29 PM, cc wrote: And it successfully fires the 3-arg Run method of the callback object. However for some reason the function table of the ISteamClient seems to be off by one.. it kept calling the wrong methods until I commented one out, in this case GetIntPtr() as seen above,

Re: delegates and functions

2018-06-10 Thread OlegZ via Digitalmars-d-learn
On Saturday, 9 June 2018 at 22:28:22 UTC, Ali Çehreli wrote: There is some explanation at the following page, of how the lambda syntax is related to the full syntax: http://ddili.org/ders/d.en/lambda.html#ix_lambda.=%3E copy rect from article as image

Re: Access to structures defined in C

2018-06-10 Thread Joe via Digitalmars-d-learn
On Sunday, 10 June 2018 at 17:59:12 UTC, Joe wrote: That worked but now I have a more convoluted case: a C array of pointers to int pointers, e.g., int **xs[] = {x1, x2, 0}; int *x1[] = {x1a, 0}; int *x2[] = {x2a, x2b, 0}; ... int x2a[] = { 1, 3, 5, 0}; Only the first line is exposed (and

Re: delegates and functions

2018-06-10 Thread drug via Digitalmars-d-learn
On 10.06.2018 12:21, OlegZ wrote: On Saturday, 9 June 2018 at 22:28:22 UTC, Ali Çehreli wrote: There is some explanation at the following page, of how the lambda syntax is related to the full syntax:   http://ddili.org/ders/d.en/lambda.html#ix_lambda.=%3E copy rect from article as image

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

2018-06-10 Thread cc via Digitalmars-d-learn
On Sunday, 10 June 2018 at 10:47:58 UTC, rikki cattermole wrote: On 10/06/2018 10:29 PM, cc wrote: And it successfully fires the 3-arg Run method of the callback object. However for some reason the function table of the ISteamClient seems to be off by one.. it kept calling the wrong methods

Re: WTF! new in class is static?!?!

2018-06-10 Thread Bauss via Digitalmars-d-learn
On Sunday, 10 June 2018 at 02:34:11 UTC, KingJoffrey wrote: On Sunday, 10 June 2018 at 01:27:50 UTC, bauss wrote: On Saturday, 9 June 2018 at 12:40:07 UTC, RealProgrammer wrote: maybe you and others in the D 'community' should start paying attention to the 'opinions' of those who do

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

2018-06-10 Thread rikki cattermole via Digitalmars-d-learn
On 10/06/2018 11:28 PM, cc wrote: Woops, that GetIntPtr came from the .cs header in the same folder as the C++ headers distributed with the SDK, that'll teach me to ctrl+f "class ISteamClient" in all open files and copy/paste before reading. Stay with the c/c++ headers for c/c++ code. We

Re: delegates and functions

2018-06-10 Thread drug via Digitalmars-d-learn
On 10.06.2018 20:58, SrMordred wrote: a => { return 2*a; }   /\  \   /   ||   \ /   ||    \   /   || \ /   ||  \   /  This is   \ /  function   \  This is definition of delegate  definition  \ so you have a function that returns delegate. ``` it's like a =>

@nogc logging library

2018-06-10 Thread basiliscos via Digitalmars-d-learn
Hi, I'm D-newbie and looking for no-gc loggig library, ideally with timestamps and formatting with output to stdout / file. Is there any? Thanks! WBR, basiliscos

Re: Access to structures defined in C

2018-06-10 Thread Joe via Digitalmars-d-learn
On Wednesday, 14 March 2018 at 02:17:57 UTC, Adam D. Ruppe wrote: The type system would *like* to know, certainly for correct range errors, but if you declare it as the wrong length and use the .ptr, it still works like it does in C: extern(C) __gshared extern char*[1] files; // still works

Re: delegates and functions

2018-06-10 Thread SrMordred via Digitalmars-d-learn
a => { return 2*a; } /\ \ / || \ / ||\ / || \ / || \ / This is \ / function \ This is definition of delegate definition \ so you have a function that returns delegate. ``` it's like a => a => 2*a; or (a){ return () {

What is the point of nothrow?

2018-06-10 Thread Bauss via Digitalmars-d-learn
What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you can't really use it as protection to write bugless, safe code since the nasty bugs will pass by just fine. I'm aware that it's a

Re: What is the point of nothrow?

2018-06-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: > What is the point of nothrow if it can only detect when Exception > is thrown and not when Error is thrown? > > It seems like the attribute is useless because you can't really > use it as protection to write bugless, safe

How to sort byCodeUnit.permutations.filter(...)

2018-06-10 Thread Uknown via Digitalmars-d-learn
I wrote a small program for Project Euler problem 41 ( https://projecteuler.net/problem=41 ). --- project_euler_41.d void main() { import math_common : primesLessThan; import std.stdio : writeln; import std.conv : parse; import std.algorithm : permutations,

Re: How to sort byCodeUnit.permutations.filter(...)

2018-06-10 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 11 June 2018 at 04:06:44 UTC, Uknown wrote: The problem is this prints a list of numbers. The task requires only the largest, so the intuitive fix I would just pull the max out of it. http://dpldocs.info/experimental-docs/std.algorithm.searching.maxElement.2.html

Re: What is the point of nothrow?

2018-06-10 Thread Bauss via Digitalmars-d-learn
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: On Sunday, June 10, 2018 23:59:17 Bauss via Digitalmars-d-learn wrote: What is the point of nothrow if it can only detect when Exception is thrown and not when Error is thrown? It seems like the attribute is useless because you

Re: What is the point of nothrow?

2018-06-10 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, June 11, 2018 04:11:38 Bauss via Digitalmars-d-learn wrote: > I'm very well aware that Error is not supposed to be caught and > that the program is in an invalid state, but ehat I'm trying to > get at is that if nothrow or at least a feature similar existed > that could detect code that

Re: How to sort byCodeUnit.permutations.filter(...)

2018-06-10 Thread Uknown via Digitalmars-d-learn
On Monday, 11 June 2018 at 04:12:57 UTC, Adam D. Ruppe wrote: On Monday, 11 June 2018 at 04:06:44 UTC, Uknown wrote: The problem is this prints a list of numbers. The task requires only the largest, so the intuitive fix I would just pull the max out of it.