flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > fasm as DLL

Goto page Previous  1, 2, 3, 4, 5  Next
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 28 Apr 2009, 22:17
Doesn't the term "managed" mean code runs under some sort of virtual machine, like here ?
Post 28 Apr 2009, 22:17
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
comrade



Joined: 16 Jun 2003
Posts: 1140
Location: Russian Federation
comrade 30 Apr 2009, 03:57
vid wrote:
Sorry, there is no 64-bit version of this code, and rewriting it would be a HUUUGE project. What do you need it for anyway? (AFAIK all systems that run 64-bit PE DLLs also support 32-bit code)


64-bit windows can run legacy x86 apps, but you can never mix and match 32-bit and 64-bit modules in the same process.

vid wrote:
Doesn't the term "managed" mean code runs under some sort of virtual machine, like here ?


Managed code is practically more of MSFT's term for .NET code. Since it is jitted and is ultimately run as native code, it can certainly interact with native code in DLLs inside the same process. Afaik with latest VS, you can target x86 and x64 even for .NET apps. Whatever the native target is, they have to match any native DLLs you are interop'ing with.

_________________
comrade (comrade64@live.com; http://comrade.ownz.com/)
Post 30 Apr 2009, 03:57
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu 19 Aug 2009, 09:56
comrade wrote:
vid wrote:
Sorry, there is no 64-bit version of this code, and rewriting it would be a HUUUGE project. What do you need it for anyway? (AFAIK all systems that run 64-bit PE DLLs also support 32-bit code)


64-bit windows can run legacy x86 apps, but you can never mix and match 32-bit and 64-bit modules in the same process.
You can, if you don't mind the ~400 clock round trip performance penalty from switching back and forth.
You can even do it on a 32bit OS, with the help of a kernel mode driver.



comrade wrote:
vid wrote:
Doesn't the term "managed" mean code runs under some sort of virtual machine, like here ?


Managed code is practically more of MSFT's term for .NET code. Since it is jitted and is ultimately run as native code, it can certainly interact with native code in DLLs inside the same process. Afaik with latest VS, you can target x86 and x64 even for .NET apps. Whatever the native target is, they have to match any native DLLs you are interop'ing with.
Don't modern VMs run the code natively (on hardware, not emulated in software) also?
Post 19 Aug 2009, 09:56
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
master92



Joined: 29 Dec 2008
Posts: 10
master92 23 Aug 2009, 15:59
Yardman wrote:
Tomasz,

Could FASMDLL.ZIP be updated to work with 1.67.27?

A slightly different structure of source includes does
not allow me to compile.


same problem with fasm 1.68...
don't get it compile...

Quote:
flat assembler version 1.68 (1878545 kilobytes memory)
fasmDLL\SOURCE\DLL\..\assemble.inc [2031]:
je invoked_error
error: undefined symbol 'invoked_error'.


would be great if someone could help me :) thanks
Post 23 Aug 2009, 15:59
View user's profile Send private message ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8263
Location: Kraków, Poland
Tomasz Grysztar 04 Sep 2010, 17:03
I have uploaded the new version of DLL, which works with the latest 1.69 cores. And it comes pre-assembled with 1.69.18 core, so you can use it to assemble AVX code.

There is no .fas-generating functionality available through the DLL API. If there is a demand for such feature I think I may in future expand the FASM_STATE structure to contain the pointers to various .fas blocks (just like the offset in the .fas header, but they would be a pointers to memory).
Post 04 Sep 2010, 17:03
View user's profile Send private message Visit poster's website Reply with quote
edemko



Joined: 18 Jul 2009
Posts: 549
edemko 04 Sep 2010, 19:15
Post 04 Sep 2010, 19:15
View user's profile Send private message Reply with quote
master92



Joined: 29 Dec 2008
Posts: 10
master92 04 Sep 2010, 19:45
Wow, thx.
My latest post was one year ago and I didn't think I'd get an answer after a few weeks. And now, one year later...
If the board didn't bring it to mind via e-mail, I probably wouldn't have noticed it Very Happy
Thank you for your work, Thomasz. Probably I'll resume my old project using FASM one day ;D
Post 04 Sep 2010, 19:45
View user's profile Send private message ICQ Number Reply with quote
Abyx



Joined: 17 Apr 2008
Posts: 9
Abyx 27 Oct 2010, 19:49
Tomasz Grysztar, would you make fasm_Assemble stdcall? It doesn't preserve registers, so it's impossible to call it from HLL without an assembly wrapper.

The patch is
Code:
--- /fasm/SOURCE/DLL/old_FASM.ASM     !@ >:B 27 21:12:49 2010
+++ /fasm/SOURCE/DLL/FASM.ASM     !@ >:B 27 22:03:58 2010
@@ -95,7 +95,7 @@
     mov    eax,[hDisplayPipe]
     mov    [display_pipe],eax
 
-    push    ebp
+    push    ebp ebx esi edi
     mov    eax,esp
     mov    [esp_save],eax
     and    eax,not 0FFFh
@@ -111,8 +111,8 @@
     mov    [ebx+FASM_STATE.condition],FASM_OK
 
   done:
-    pop    ebp
     mov    eax,[ebx+FASM_STATE.condition]
+    pop    edi esi ebx ebp
     ret    20
 
   general_error:
    


Patched fasm.asm (for fasm.dll) in attach.


Description:
Download
Filename: FASM.ASM
Filesize: 8.04 KB
Downloaded: 1256 Time(s)

Post 27 Oct 2010, 19:49
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8263
Location: Kraków, Poland
Tomasz Grysztar 27 Oct 2010, 19:57
Oh, yes, sorry for that bug, I forgot.
I updated the attachment in first post.
Post 27 Oct 2010, 19:57
View user's profile Send private message Visit poster's website Reply with quote
Abyx



Joined: 17 Apr 2008
Posts: 9
Abyx 28 Oct 2010, 06:02
Thanks
Post 28 Oct 2010, 06:02
View user's profile Send private message Reply with quote
ishkabible



Joined: 13 Sep 2010
Posts: 54
ishkabible 04 Nov 2010, 21:00
could this be use with c and c++ to do some JIT compiling? or am i misunderstanding how it works. dose it compile the file in memory so that you can save it to an executable or dose it actually load the program so that it can be run?
Post 04 Nov 2010, 21:00
View user's profile Send private message Reply with quote
masonswanson



Joined: 17 Aug 2010
Posts: 51
masonswanson 03 Dec 2010, 13:27
you could use it from any hll which supports c calling conventions and dlls, it can take a null terminated string containing assembly and produce machine code using Assemble(char *) or it can assemble an indicated assembly file using Assemble_File(File)
Post 03 Dec 2010, 13:27
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger Reply with quote
ptr51



Joined: 22 Dec 2010
Posts: 1
ptr51 22 Dec 2010, 14:42
Hello!

Im trying to bould the fasm.dll as a MS COFF file instead to link it statically. But my asm is sort of at a less advanced level so i cant really figure out why it crashes in runtime inside fasm_Assemble.

Anyone here managed to build it as an obj? Any help would be greatly appreciated.


Test code:
compiled with /link FASM.OBJ
Code:
extern "C" unsigned int fasm_Assemble(char * szSource, unsigned char * lpMemory, int nSize, int nPassesLimit);

int main(int argc, char* argv[])
{
   unsigned char buf[4096];
   fasm_Assemble("mov eax, eax", buf, 4096, 100);
   return 0;
}
    


unified diff on how to mod FASM.ASM to make it compile is attached. (dont know if i got it right though)


Description: vs 2008 error printscreen
Filesize: 108.07 KB
Viewed: 34059 Time(s)

fasm_error.jpg


Description: how to make a .OBJ compile
Download
Filename: fasm_dll_to_obj_diff.txt
Filesize: 1.92 KB
Downloaded: 1392 Time(s)

Post 22 Dec 2010, 14:42
View user's profile Send private message Reply with quote
masonswanson



Joined: 17 Aug 2010
Posts: 51
masonswanson 10 Apr 2011, 05:58
How Would I Turn This Into A Linux Shared Object File? (.so)
Post 10 Apr 2011, 05:58
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger Reply with quote
masonswanson



Joined: 17 Aug 2010
Posts: 51
masonswanson 20 Feb 2012, 03:05
For Some Reason I Can No Longer Access The Zip File In The First Post, Perhaps It Has Been Corrupted?
Post 20 Feb 2012, 03:05
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger Reply with quote
shutdownall



Joined: 02 Apr 2010
Posts: 517
Location: Munich
shutdownall 21 Feb 2012, 22:39
I can open it with no problems at all. Wink
Post 21 Feb 2012, 22:39
View user's profile Send private message Send e-mail Reply with quote
masonswanson



Joined: 17 Aug 2010
Posts: 51
masonswanson 25 Feb 2012, 07:24
Yes well now i can, before the download was only 14Kb, i don't know what happened but it's seems fine now
Post 25 Feb 2012, 07:24
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger Reply with quote
kalambong



Joined: 08 Nov 2008
Posts: 165
kalambong 06 Apr 2012, 08:48
Tomasz Grysztar wrote:
The subject says all. Wink

I've made fasm into a simple DLL which allows to assembly just inside the memory. The package contains short documentation, demonstration program (which uses also the AsmEdit in DLL form) and the SOURCE directory, which needs to be merged with SOURCE directory of standard fasm's distributions.



Tomasz,

Is 1.69.50 available as a DLL ?
Post 06 Apr 2012, 08:48
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8263
Location: Kraków, Poland
Tomasz Grysztar 06 Apr 2012, 09:16
Uploaded it now.
Post 06 Apr 2012, 09:16
View user's profile Send private message Visit poster's website Reply with quote
kalambong



Joined: 08 Nov 2008
Posts: 165
kalambong 08 Apr 2012, 01:19
Tomasz Grysztar wrote:
Uploaded it now.



Thank you very much, Tomasz !! Laughing
Post 08 Apr 2012, 01:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3, 4, 5  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.