flat assembler
Message board for the users of flat assembler.
Index
> High Level Languages > Calling FASM code from D example |
Author |
|
OzzY 16 Dec 2006, 02:38
Hi guys!
Here it is an example of calling FASM code from D. I've created a simple hello world function in FASM and assembled as DLL. Then I've created a D source file showing how to call this function. I hope you like it and try the D language (it's really nice). Now you see how to mix D and FASM, so no excuse to not use it! Source codes and executables are in zip file. Enjoy! Step 1 Assembling: Quote:
Step 2 Compiling D code: 1) Get DMD at www.digitalmars.com 2) Install it following the site instructions 3) Compile like this: Quote:
Step 3 Run dpart.exe PS: Soon, I'll add an example of static linking as soon as I find a way to deal with OMF object files.
|
|||||||||||
16 Dec 2006, 02:38 |
|
Vortex 16 Dec 2006, 08:25
You should try to convert OMF modules to MS COFF with the help of the MS linker :
Code: link -edit objfile.obj _________________ Code it... That's all... |
|||
16 Dec 2006, 08:25 |
|
vid 17 Dec 2006, 02:10
so this is in fact example of calling DLL (written in FASM) from D?
|
|||
17 Dec 2006, 02:10 |
|
OzzY 17 Dec 2006, 17:27
Yes, but there are some tricks in the D code to make it possible to import the functions.
|
|||
17 Dec 2006, 17:27 |
|
nermest 07 Jul 2007, 14:22
btw, you don't have to create dll for using C-like functions(from C or fasm sources)!
extern (C) fasm_func(char val, char*vals, int num); |
|||
07 Jul 2007, 14:22 |
|
OzzY 19 Jan 2008, 21:18
nermest wrote: btw, you don't have to create dll for using C-like functions(from C or fasm sources)! The problem is that fasm doesn't produce OMF. So we need to convert COFF->OMF in some way. Do you know any tool? |
|||
19 Jan 2008, 21:18 |
|
Uwar 13 Oct 2009, 18:19
DigitalMars: coff2omf or Agner Fog http://www.agner.org/optimize/objconv.zip
|
|||
13 Oct 2009, 18:19 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.