Unable to pass a D function member to a C callback

2019-11-02 Thread Luh via Digitalmars-d-learn
Hello, When trying to pass a D function to the C callback, the compiler says: 'Error: cannot implicitly convert expression of type extern (C) bool delegate(const(short*) a, ulong b, void* c) to extern (C) bool function(const(short*), ulong, void*' because my function is member of a class

Re: Is there any writeln like functions without GC?

2019-11-02 Thread Seb via Digitalmars-d-learn
On Thursday, 31 October 2019 at 16:03:22 UTC, bachmeier wrote: On Thursday, 31 October 2019 at 15:11:42 UTC, Ferhat Kurtulmuş wrote: It would be nice if one reimplement writeln of Phobos by bypassing gc and use a custom nogc exception as described here*? Of course I can imagine that it would

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Luh via Digitalmars-d-learn
On Saturday, 2 November 2019 at 18:31:28 UTC, Stefan Koch wrote: On Saturday, 2 November 2019 at 17:49:09 UTC, Luh wrote: Hello, When trying to pass a D function to the C callback, the compiler says: 'Error: cannot implicitly convert expression of type extern (C) bool

Re: Is there any writeln like functions without GC?

2019-11-02 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, October 31, 2019 9:11:42 AM MDT Ferhat Kurtulmuş via Digitalmars-d-learn wrote: > On Thursday, 31 October 2019 at 13:46:07 UTC, Adam D. Ruppe wrote: > > On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: > >> Hi: > >>why writeln need GC? > > > > It almost never does, it

Execute certain Tests?

2019-11-02 Thread Martin Brezel via Digitalmars-d-learn
Is there a trick to execute only the test, defined in one file? Or the Tests of a certain Module? Or in general: How to avoid to execute all the tests, when running "dub test"? It doesn't has to be dub, though.

Re: Execute certain Tests?

2019-11-02 Thread Paul Backus via Digitalmars-d-learn
On Saturday, 2 November 2019 at 17:27:14 UTC, Martin Brezel wrote: Is there a trick to execute only the test, defined in one file? Or the Tests of a certain Module? Or in general: How to avoid to execute all the tests, when running "dub test"? It doesn't has to be dub, though. dmd -unittest

Re: Execute certain Tests?

2019-11-02 Thread Max Haughton via Digitalmars-d-learn
On Saturday, 2 November 2019 at 17:27:14 UTC, Martin Brezel wrote: Is there a trick to execute only the test, defined in one file? Or the Tests of a certain Module? Or in general: How to avoid to execute all the tests, when running "dub test"? It doesn't has to be dub, though. Not by

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Dennis via Digitalmars-d-learn
On Saturday, 2 November 2019 at 20:42:29 UTC, Luh wrote: Yup that's it ! Many thanks ! One word of warning: ensure the C library does not have the only reference to your Game class instance, or the garbage collector might deallocate it since it does not scan threads created by C libraries.

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Alex via Digitalmars-d-learn
On Saturday, 2 November 2019 at 17:49:09 UTC, Luh wrote: Hello, When trying to pass a D function to the C callback, the compiler says: 'Error: cannot implicitly convert expression of type extern (C) bool delegate(const(short*) a, ulong b, void* c) to extern (C) bool

Which is the active fork in DFL gui library ?

2019-11-02 Thread Vinod K Chandran via Digitalmars-d-learn
Hi all, I just found that DFL gui library very interesting. But after some searching, i can see that DFL is inactive and there is few other forks for it. So this is my question - Which fork is good for a gui development in windows platform. BTW, i just tested the gtkD and successfully compiled

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Stefan Koch via Digitalmars-d-learn
On Saturday, 2 November 2019 at 17:49:09 UTC, Luh wrote: Hello, When trying to pass a D function to the C callback, the compiler says: 'Error: cannot implicitly convert expression of type extern (C) bool delegate(const(short*) a, ulong b, void* c) to extern (C) bool

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Dennis via Digitalmars-d-learn
On Saturday, 2 November 2019 at 19:42:54 UTC, Luh wrote: So I think I just can't. :( Is that `void* c` in the callback a context pointer by any chance? That's a common thing in C callbacks precisely for purposes like this. You can cast your class to a void* when you register the callback and

Re: Unable to pass a D function member to a C callback

2019-11-02 Thread Luh via Digitalmars-d-learn
On Saturday, 2 November 2019 at 19:55:58 UTC, Dennis wrote: On Saturday, 2 November 2019 at 19:42:54 UTC, Luh wrote: So I think I just can't. :( Is that `void* c` in the callback a context pointer by any chance? That's a common thing in C callbacks precisely for purposes like this. You can

Re: Is there any writeln like functions without GC?

2019-11-02 Thread 9il via Digitalmars-d-learn
On Thursday, 31 October 2019 at 03:56:56 UTC, lili wrote: Hi: why writeln need GC? See also Mir's @nogc formatting module https://github.com/libmir/mir-runtime/blob/master/source/mir/format.d