Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 16, 2006 Native D functions & Assembler modules | ||||
---|---|---|---|---|
| ||||
Hello, I'm asking myself for a few days now if it'd be possible to call native D functions (without "extern(C)") directly out of an assembler module (compiled with nasm, for example). As far as I know D has a little different function naming convention than C, so it would be interesting if there's a static definition of how native functions are named. I didn't find any information on the official D site, so I thought it'd be a good idea to ask in the newsgroup so Walter or some uber-mighty D coder could have a chance to answer. Thanks in advance and regards, Alex |
February 16, 2006 Re: Native D functions & Assembler modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Panek | Alexander Panek wrote:
> Hello,
>
> I'm asking myself for a few days now if it'd be possible to call native D functions (without "extern(C)") directly out of an assembler module (compiled with nasm, for example). As far as I know D has a little different function naming convention than C, so it would be interesting if there's a static definition of how native functions are named.
In the same vein, it might be nice if we could forward-declare functions defined in other modules.
Sean
|
February 16, 2006 Re: Native D functions & Assembler modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | I think you can, if you make them static class members <g> class Utils { static int myFunc(int); static bool myOtherFunc(int); } "Sean Kelly" <sean@f4.ca> wrote in message news:dt2rug$1b1p$2@digitaldaemon.com... > Alexander Panek wrote: >> Hello, >> >> I'm asking myself for a few days now if it'd be possible to call native D functions (without "extern(C)") directly out of an assembler module (compiled with nasm, for example). As far as I know D has a little different function naming convention than C, so it would be interesting if there's a static definition of how native functions are named. > > In the same vein, it might be nice if we could forward-declare functions defined in other modules. > > > Sean |
February 16, 2006 Re: Native D functions & Assembler modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Panek | "Alexander Panek" <alexander.panek@brainsware.org> wrote in message news:dt2jtu$14qu$1@digitaldaemon.com... > I'm asking myself for a few days now if it'd be possible to call native D functions (without "extern(C)") directly out of an assembler module (compiled with nasm, for example). Sure. In order to see how to do it, call the function in D. Then, obj2asm the resulting .obj file, that'll tell you the name mangling and the calling convention. |
February 21, 2006 Re: Native D functions & Assembler modules | ||||
---|---|---|---|---|
| ||||
Posted in reply to Alexander Panek | Alexander Panek wrote: > Hello, > > I'm asking myself for a few days now if it'd be possible to call native D functions (without "extern(C)") directly out of an assembler module (compiled with nasm, for example). As far as I know D has a little different function naming convention than C, so it would be interesting if there's a static definition of how native functions are named. import std.stdio; // put your function here... char [] f(int a, Whatever w) { } void main() { writefln( f.mangleof); } > > I didn't find any information on the official D site, so I thought it'd be a good idea to ask in the newsgroup so Walter or some uber-mighty D coder could have a chance to answer. > > Thanks in advance and regards, > Alex |
Copyright © 1999-2021 by the D Language Foundation