July 12, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | > Is this going to be fixed any time soon? Allowing callbacks with D > calling convention where a C callback is expected should be an error, > and this is like the 10th time I've ran into this bug. http://d.puremagic.com/issues/show_bug.cgi?id=3797 |
July 12, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | On 7/12/11, Trass3r <un@known.com> wrote:
>> Is this going to be fixed any time soon? Allowing callbacks with D calling convention where a C callback is expected should be an error, and this is like the 10th time I've ran into this bug.
>
> http://d.puremagic.com/issues/show_bug.cgi?id=3797
>
Thanks, I'm voting this up
|
July 12, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Oh there's a pull already, this is great. https://github.com/D-Programming-Language/dmd/pull/96 |
July 13, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.1569.1310506439.14074.digitalmars-d-learn@puremagic.com... > Is this going to be fixed any time soon? Allowing callbacks with D calling convention where a C callback is expected should be an error, and this is like the 10th time I've ran into this bug. What, the bug that annoyed me so much I fixed it myself? Yeah, this should be gone by the next release. |
July 13, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On 7/13/11, Daniel Murphy <yebblies@nospamgmail.com> wrote:
> "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.1569.1310506439.14074.digitalmars-d-learn@puremagic.com...
>> Is this going to be fixed any time soon? Allowing callbacks with D calling convention where a C callback is expected should be an error, and this is like the 10th time I've ran into this bug.
>
> What, the bug that annoyed me so much I fixed it myself? Yeah, this should be gone by the next release.
>
Thanks! I've literally lost an entire day once when I was just starting using D and C together and had a calling convention mismatch. :x
|
July 13, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message news:mailman.1607.1310570915.14074.digitalmars-d-learn@puremagic.com... > Thanks! I've literally lost an entire day once when I was just starting using D and C together and had a calling convention mismatch. :x It's worse than just calling conventions - try changing the parameter types! (or basically anything except the return type) |
July 13, 2011 Re: Declaring a D pointer to a C function | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Wed, 13 Jul 2011 11:32:50 -0400, Daniel Murphy <yebblies@nospamgmail.com> wrote:
> "Andrej Mitrovic" <andrej.mitrovich@gmail.com> wrote in message
> news:mailman.1607.1310570915.14074.digitalmars-d-learn@puremagic.com...
>> Thanks! I've literally lost an entire day once when I was just
>> starting using D and C together and had a calling convention mismatch.
>> :x
>
> It's worse than just calling conventions - try changing the parameter types!
> (or basically anything except the return type)
Yeah, examining the assembly, a major difference is that D passes one parameter in a register, whereas C pushes it on the stack. This means you are going to have off-by-one corruption any time you access a parameter.
-Steve
|
Copyright © 1999-2021 by the D Language Foundation