Re: Pointer to method C++ style

2009-07-24 Thread Sergey Gromov
Fri, 24 Jul 2009 02:51:45 +0400, Sergey Gromov wrote: > Thu, 23 Jul 2009 19:07:43 +0200, BLS wrote: > >> Sergey Gromov wrote: >>> Sorry, I'm not a guru at all, so ActiveX was a misnomer. What I'm >>> writing is a simple in-process server DLL which implements a couple of >>> interfaces. >> >> Oh

Re: Pointer to method C++ style

2009-07-24 Thread Sergey Gromov
Fri, 24 Jul 2009 09:07:30 -0400, Steven Schveighoffer wrote: > On Thu, 23 Jul 2009 22:09:12 -0400, Sergey Gromov > wrote: > >> Thu, 23 Jul 2009 11:54:40 -0400, Steven Schveighoffer wrote: >> >>> LOOKUP_TABLE[0] = Method("method1", &Component.method1); >>> LOOKUP_TABLE[1] = Me

Re: Pointer to method C++ style

2009-07-24 Thread Steven Schveighoffer
On Fri, 24 Jul 2009 09:56:41 -0400, grauzone wrote: LOOKUP_TABLE[0] = Method("method1", &Component.method1); LOOKUP_TABLE[1] = Method("method2", &Component.method2); These two lines are weird. ``pragma(msg)`` shows that type of ``&method1`` is ``void function()`` while it m

Re: Pointer to method C++ style

2009-07-24 Thread grauzone
LOOKUP_TABLE[0] = Method("method1", &Component.method1); LOOKUP_TABLE[1] = Method("method2", &Component.method2); These two lines are weird. ``pragma(msg)`` shows that type of ``&method1`` is ``void function()`` while it must be ``void delegate()`` for a non-static member beca

Re: Pointer to method C++ style

2009-07-24 Thread Steven Schveighoffer
On Thu, 23 Jul 2009 22:09:12 -0400, Sergey Gromov wrote: Thu, 23 Jul 2009 11:54:40 -0400, Steven Schveighoffer wrote: On Wed, 22 Jul 2009 23:47:30 -0400, Sergey Gromov wrote: Is there a way to declare and statically initialize some sort of pointer to method, and later call it for an

Re: Pointer to method C++ style

2009-07-23 Thread Sergey Gromov
Thu, 23 Jul 2009 11:54:40 -0400, Steven Schveighoffer wrote: > On Wed, 22 Jul 2009 23:47:30 -0400, Sergey Gromov > wrote: > >> Is there a way to declare and statically initialize some sort of pointer >> to method, and later call it for an actual object instance? > > I don't know why the "non

Re: Pointer to method C++ style

2009-07-23 Thread Sergey Gromov
Thu, 23 Jul 2009 19:07:43 +0200, BLS wrote: > Sergey Gromov wrote: >> Sorry, I'm not a guru at all, so ActiveX was a misnomer. What I'm >> writing is a simple in-process server DLL which implements a couple of >> interfaces. > > Oh, that's sad. :( > > well, especially in this case I would sugge

Re: Pointer to method C++ style

2009-07-23 Thread BLS
Sergey Gromov wrote: Thu, 23 Jul 2009 12:37:42 +0200, BLS wrote: Sorry, I'm not a guru at all, so ActiveX was a misnomer. What I'm writing is a simple in-process server DLL which implements a couple of interfaces. Oh, that's sad. :( well, especially in this case I would suggest to have a

Re: Pointer to method C++ style

2009-07-23 Thread Steven Schveighoffer
On Wed, 22 Jul 2009 23:47:30 -0400, Sergey Gromov wrote: Is there a way to declare and statically initialize some sort of pointer to method, and later call it for an actual object instance? I don't know why the "non constant expression error" happens, but constructing a delegate from func

Re: Pointer to method C++ style

2009-07-23 Thread Sergey Gromov
Thu, 23 Jul 2009 04:11:14 + (UTC), BCS wrote: > Hello Sergey, > >> Is there a way to declare and statically initialize some sort of >> pointer to method, and later call it for an actual object instance? >> > > dosn't work but might point you in the right direction: > > template Pn2Fn(R, ch

Re: Pointer to method C++ style

2009-07-23 Thread Sergey Gromov
Thu, 23 Jul 2009 12:37:42 +0200, BLS wrote: >Sergey Gromov wrote: >> Use case: I'm writing an ActiveX plug-in for a dynamic language. The > > However, I am _very_ interested in having/seeing the source of a very > basic ActiveX control. Any chance that you share the core implementation > with u

Re: Pointer to method C++ style

2009-07-23 Thread BLS
Sergey Gromov wrote: Use case: I'm writing an ActiveX plug-in for a dynamic language. The class Component : IUnknown WOW! But shouldn't you use class Component : IDispatch { HRESULT QueryInterface( REFIID riid, LPVOID * ppvObj) {}; ULONG AddRef() {}; ULONG Release(){}; // plu

Re: Pointer to method C++ style

2009-07-22 Thread BCS
Hello Sergey, Is there a way to declare and statically initialize some sort of pointer to method, and later call it for an actual object instance? dosn't work but might point you in the right direction: template Pn2Fn(R, char[] method) { ReturnTypeOf!(mixin("R." ~ method)) Pn2Fn(R r, Arg

Pointer to method C++ style

2009-07-22 Thread Sergey Gromov
Is there a way to declare and statically initialize some sort of pointer to method, and later call it for an actual object instance? Use case: I'm writing an ActiveX plug-in for a dynamic language. The language queries the component for implemented methods, then it requests these methods to be ex