Simen kjaeraas wrote:
dennis luehring wrote:
D still won't accept an delegat in an extern C because this type does
not exists in the C world
Nor do classes, and those certainly can be passed to a C-linkage
function.
Yes, but I think that's a bug too. Quite a horrible one, in fact, since
t
Am 06.06.2010 17:30, schrieb Zarathustra:
are delegats part of the ABI, i can't find a delegat calling scheme in
the ABI-Description - should this be in EAX, as last/first part on
stack, ECX?
The delegates are called by exactly same way as any other member function. Put
ptr
= 'this'(context
Zarathustra:
> I think there is a good chance for create the set examples which show how to
> use D
> features on the C level. I will thinking about it in my free time :) The idea
> is
> really interesting and it would be useful(especially to better understand
> these
> mechanisms) for some peop
> my fault - yes its possible to use delegates in non D but delegat-struct
> knowing languages (and a small pice of special calling code), sorry
> Zarathrustra i missed the point of your post in whole
No problem, I'm glad that we have reached an agreement.
> wouldn't it be nice to have an complete
Am 06.06.2010 11:33, schrieb Simen kjaeraas:
Also, pointers to delegates can be passed to C-linkage functions. A
delegate is nothing but a struct, and as such there is no reason for
it not to be passable to a C-linkage function.
my fault - yes its possible to use delegates in non D but delegat-
dennis luehring wrote:
D still won't accept an delegat in an extern C because this type does
not exists in the C world
Nor do classes, and those certainly can be passed to a C-linkage
function.
Also, pointers to delegates can be passed to C-linkage functions. A
delegate is nothing but a str
> but that will help on the caller side (you using gcc?) but D still won't
> accept an delegat in an extern C because this type does not exists in
> the C world
Maybe it is the reason but the error message is still nonsense.
> btw: can show us code where you do this and it works - why don't you us
Am 05.06.2010 16:03, schrieb dennis luehring:
Am 05.06.2010 15:42, schrieb Zarathustra:
only with static methods - a real delegate needs the this-pointer in a
register (not on the stack), thats the main difference between function
ptr and delegates, thats why you can't use a (non static) m
Am 05.06.2010 15:42, schrieb Zarathustra:
only with static methods - a real delegate needs the this-pointer in a
register (not on the stack), thats the main difference between function
ptr and delegates, thats why you can't use a (non static) method on for
example the win-api callbacks, becau
> only with static methods - a real delegate needs the this-pointer in a
> register (not on the stack), thats the main difference between function
> ptr and delegates, thats why you can't use a (non static) method on for
> example the win-api callbacks, because the caller don't know your object
gc
Am 05.06.2010 13:33, schrieb Zarathustra:
Secondly, I'm not sure if you can pass delegates to a C function. C code
wouldn't understand delegates. They are not the same as function
pointers. I suggest you use function pointers instead, paying attention
to linkage.
Of course It is possible, b
> For starters, your first delegate is declared in an extern(C) block,
> meaning it has C linkage. The second is declared outside of the block,
> meaning it has D linkage. So they are two different types of delegates.
What is the difference?
> Secondly, I'm not sure if you can pass delegates to a
Mike Parker wrote:
For starters, your first delegate is declared in an extern(C) block,
meaning it has C linkage. The second is declared outside of the block,
meaning it has D linkage. So they are two different types of delegates.
If this is correct, the problem should be fixable by writin
Zarathustra wrote:
I have obtained a strange error message when I tried to use delegate as an
argument in a C linkage function.
private extern (C) static {
void d_foo_add_event_handler(Foo, void delegate());
}
class Foo {
void addEventHandler(void delegate() handler) {
d_foo_add_event_h
I have obtained a strange error message when I tried to use delegate as an
argument in a C linkage function.
private extern (C) static {
void d_foo_add_event_handler(Foo, void delegate());
}
class Foo {
void addEventHandler(void delegate() handler) {
d_foo_add_event_handler(this, handler)
15 matches
Mail list logo