flat assembler
Message board for the users of flat assembler.
Index
> Windows > fasmg dll call |
Author |
|
bitRAKE 04 Jun 2023, 11:16
We can see from the source code that the DLL exports two functions, and the assembly function uses six parameters. It's a 32-bit DLL using the standard 32-bit ABI - parameters pass on the stack.
Code: invoke fasmg_Assemble,\ source_string,\ ; source string NULL,\ ; source path aout,\ ; output region NULL,\ ; output path [hStdOut],\ ; stdout [hStdErr] ; stderr test eax,eax jnz error Code: ; fasmg-powered mini assembler using, ; flat assembler version g.k0v2 include 'cpu\p6.inc' use32 xor eax, eax |
|||
04 Jun 2023, 11:16 |
|
Andy 04 Jun 2023, 11:41
I know how to use the DLL from HLL and I think also that I understand the exported functions of fasmg.dll. The problem is when I have to include files like format/pe.inc, which include cpu/8086.inc. How does fasmg.dll know where the includes directory is? Is there any way to set the path for include directory like an env variable so I don't have to use full path of includes?
I tried what you said and I used this as source_string in my dll call: Code: include "<full path to fasmg>include\cpu\x64.inc use32 xor eax, eax and I get what I expected: 31 C0 |
|||
04 Jun 2023, 11:41 |
|
Tomasz Grysztar 04 Jun 2023, 13:16
First, please read the main thread documenting the DLL interface.
As for the path, the base path is simply the current directory of the parent process (you can change it with SetCurrentDirectory). It also searches the directories specified in INCLUDE environment variable, the same like console interface does. You can set up this variable for your process with SetEnvironmentVariable function. You can even change the contents of this variable between the calls to fasmg_Assemble. |
|||
04 Jun 2023, 13:16 |
|
Andy 04 Jun 2023, 13:38
Thank you. It works like a charm.
|
|||
04 Jun 2023, 13:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.