Walter: D asm syntax not consistent nor calling convention with C++

Adam Sansier via Digitalmars-d digitalmars-d at puremagic.com
Sun Jul 17 01:02:13 PDT 2016


On Sunday, 17 July 2016 at 06:23:34 UTC, Walter Bright wrote:
> On 7/16/2016 11:10 PM, Adam Sansier wrote:
>> D is not consistent with C++ in asm and calling convention.
>
> In general, it is a *lot* easier to debug inline asm issues if 
> you're willing to run obj2asm on the output and compare. No 
> need to run a debugger on a crashing program.
>
> And you're right that D has a different calling convention than 
> C++. The solution to that is declare the function in the D code 
> as 'extern (C++)'.


Nevermind, sorry! I didn't mark the callbacks extern(C++)! ;/ 
They were being called so it never occurred to me that they were 
the source of the problem. They were corrupting the stack and 
creating odd behavior in the driver code. I guess now it makes 
sense, since the crash happened soon after the callback.

D is great! Long live D! ;) Sorry for the noise!


More information about the Digitalmars-d mailing list