flat assembler
Message board for the users of flat assembler.
 Home   FAQ   Search   Register 
 Profile   Log in to check your private messages   Log in 
flat assembler > Compiler Internals > fasm as DLL

Goto page Previous  1, 2, 3  Next
Author
Thread Post new topic Reply to topic
Molajoku



Joined: 28 Apr 2009
Posts: 2
Location: England
Thanks for getting back to me. I'm trying to recompile a .dll called
fasmdll_managed for use on x64 sytems.
Sad to say however all I seem able to get for my efforts so far is:
"Error 2 fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'"

Cheers though Smile
Post 28 Apr 2009, 19:47
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7111
Location: Slovakia
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: 1103
Location: Russian Federation

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: 1160

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

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
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
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
Post 04 Sep 2010, 19:15
View user's profile Send private message Reply with quote
master92



Joined: 29 Dec 2008
Posts: 10
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
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: 476 Time(s)

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


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
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
Thanks
Post 28 Oct 2010, 06:02
View user's profile Send private message Reply with quote
ishkabible



Joined: 13 Sep 2010
Posts: 54
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
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
Build as MS COFF .OBJ file
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 * szSourceunsigned char * lpMemoryint nSizeint nPassesLimit);

int main(int argccharargv[])
{
   unsigned char buf[4096];
   fasm_Assemble("mov eax, eax"buf4096100);
   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: 13320 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: 549 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
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
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: 510
Location: Munich
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
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
Re: fasm as DLL

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
Assembly Artist


Joined: 16 Jun 2003
Posts: 6179
Location: Kraków, Poland
Uploaded it now.
Post 06 Apr 2012, 09:16
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2, 3  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


Powered by phpBB © 2001-2005 phpBB Group.

Main index   Download   Documentation   Examples   Message board
Copyright © 2004-2016, Tomasz Grysztar.