digitalmars.D - Native D functions & Assembler modules
- Alexander Panek (11/11) Feb 16 2006 Hello,
- Sean Kelly (4/11) Feb 16 2006 In the same vein, it might be nice if we could forward-declare functions...
-
Kris
(8/19)
Feb 16 2006
I think you can, if you make them static class members
- Walter Bright (5/8) Feb 16 2006 Sure. In order to see how to do it, call the function in D. Then, obj2as...
- Don Clugston (10/24) Feb 21 2006 import std.stdio;
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
Feb 16 2006
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
Feb 16 2006
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
Feb 16 2006
"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.
Feb 16 2006
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
Feb 21 2006