Re: how to use dll

2009-01-21 Thread Daniel Keep
reimi gibbons wrote: > Hi all, > > I'm currently developing a software with D and Tango. I don't have much > knowledge on DLL, but i do know when linking to static lib you need a .h > header file, but do i need .h for linking with DLL as well? > > also can anybody please provide a quick and s

Re: .tupleof.stringof

2009-01-21 Thread Christopher Wright
Christopher Wright wrote: Check this out! class Foo { int someField; } pragma (msg, Foo.tupleof[0].stringof); // int pragma (msg, Foo.tupleof[0].mangleof); // someField Why is this? It's counterintuitive. Okay, no, this example is a shorter version of something else that exemplified this beha

how to use dll

2009-01-21 Thread reimi gibbons
Hi all, I'm currently developing a software with D and Tango. I don't have much knowledge on DLL, but i do know when linking to static lib you need a .h header file, but do i need .h for linking with DLL as well? also can anybody please provide a quick and small example to link with DLL. *im t

Re: .tupleof.stringof

2009-01-21 Thread Christopher Wright
Christopher Wright wrote: Christopher Wright wrote: Check this out! class Foo { int someField; } pragma (msg, Foo.tupleof[0].stringof); // int pragma (msg, Foo.tupleof[0].mangleof); // someField Why is this? It's counterintuitive. Oops, no. mangleof does report the mangled name of the input s

Re: .tupleof.stringof

2009-01-21 Thread Christopher Wright
Christopher Wright wrote: Check this out! class Foo { int someField; } pragma (msg, Foo.tupleof[0].stringof); // int pragma (msg, Foo.tupleof[0].mangleof); // someField Why is this? It's counterintuitive. Oops, no. mangleof does report the mangled name of the input string. It's just that mang

.tupleof.stringof

2009-01-21 Thread Christopher Wright
Check this out! class Foo { int someField; } pragma (msg, Foo.tupleof[0].stringof); // int pragma (msg, Foo.tupleof[0].mangleof); // someField Why is this? It's counterintuitive.

Re: Is there a way to remove the requirement for parenthesis?

2009-01-21 Thread Denis Koroskin
On Wed, 21 Jan 2009 20:26:08 +0300, Charles Hixson wrote: P.S.: This is Digital Mars D Compiler v2.023 running on Linux Charles Hixson wrote: In this test I'm trying to emulate how I want a typedef to act, but I run into a problem: import std.stdio; struct BlockNum { uint value;

Re: query interface

2009-01-21 Thread BCS
Reply to Qian, Frits van Bommel wrote: Qian Xu wrote: Hi All, can D check, whether a class A an Interface B supports? like: if (supports(class_A, intf_B)) if (is(class_A : intf_B)) tests if 'class_A' is implicitly convertible to 'intf_B'. If the first is a class and the second an interf

Re: Is there a way to remove the requirement for parenthesis?

2009-01-21 Thread Charles Hixson
P.S.: This is Digital Mars D Compiler v2.023 running on Linux Charles Hixson wrote: In this test I'm trying to emulate how I want a typedef to act, but I run into a problem: import std.stdio; struct BlockNum { uint value; uint opCast() { return value; } void opAssig

Is there a way to remove the requirement for parenthesis?

2009-01-21 Thread Charles Hixson
In this test I'm trying to emulate how I want a typedef to act, but I run into a problem: import std.stdio; struct BlockNum { uint value; uint opCast() { return value; } void opAssign (uint val) { value = val; } uint opCall() { return value; } } voi

Re: query interface

2009-01-21 Thread Trass3r
Qian Xu schrieb: Thanks. Could you tell me, how to make a function for this? I do not know how to pass an Interface as parameter. like bool supports(T)(T obj, interface_type t) { return (is(obj : t)); } Guess something like bool supports(T, I) (T obj) { return (is(obj : I));

Re: query interface

2009-01-21 Thread Qian Xu
Frits van Bommel wrote: > Qian Xu wrote: >> Hi All, >> >> can D check, whether a class A an Interface B supports? >> >> like: >> >> if (supports(class_A, intf_B)) > > if (is(class_A : intf_B)) > tests if 'class_A' is implicitly convertible to 'intf_B'. If the first > is a class and the

Re: query interface

2009-01-21 Thread Jarrett Billingsley
On Wed, Jan 21, 2009 at 10:30 AM, Qian Xu wrote: > Hi All, > > can D check, whether a class A an Interface B supports? > > like: > > if (supports(class_A, intf_B)) > { > cast(intf_B) (class_A).hello(); > } At compile time, like Frits said, you can use is(class_A : intf_B). At runtime, you

Re: query interface

2009-01-21 Thread Frits van Bommel
Qian Xu wrote: Hi All, can D check, whether a class A an Interface B supports? like: if (supports(class_A, intf_B)) if (is(class_A : intf_B)) tests if 'class_A' is implicitly convertible to 'intf_B'. If the first is a class and the second an interface, that's equivalent to the class

Re: query interface

2009-01-21 Thread Qian Xu
Qian Xu wrote: > Hi All, > > can D check, whether a class A an Interface B supports? > > like: > > if (supports(class_A, intf_B)) > { > cast(intf_B) (class_A).hello(); > } > > --Qian what I have found is: if (is(class_A == intf_B)) { cast(intf_B) (class_A).hello(); } Is

query interface

2009-01-21 Thread Qian Xu
Hi All, can D check, whether a class A an Interface B supports? like: if (supports(class_A, intf_B)) { cast(intf_B) (class_A).hello(); } --Qian

Re: loop through specific class members

2009-01-21 Thread Trass3r
Christopher Wright schrieb: On the other hand, you can get the non-final, non-private methods of a class with something like: foreach (member; __traits (allMembers, Class)) { foreach (overload; __traits (getVirtualFunctions, Class, member)) { // do stuff } } Naturally, __tra