flat assembler
Message board for the users of flat assembler.

Index > Windows > Cannot compile 64-bit dll with FASM 1.64

Author
Thread Post new topic Reply to topic
Anatoly



Joined: 23 Sep 2005
Posts: 6
Location: Russia
Anatoly 27 Sep 2005, 13:23
Hello all, my question aims to those guys who had already tried to create DLL in new 64-bit format, and especially (if he will find time to answer) to mr. Privalov...
Problem is that if dll body contains macro 'proc', fasm 1.64 is not able to compile DLL, saying 'Illegal instruction' and pointing me to the first line with 'proc' macro. I am using 'format PE64 GUI DLL'.

As I understand this happens because in 'proc' macro still stands 'ebp' instead of 'rbp' and so on? Am I right? But correcting proc32.inc does not give anything Sad
Thanks for attention Smile
Post 27 Sep 2005, 13:23
View user's profile Send private message Reply with quote
Anatoly



Joined: 23 Sep 2005
Posts: 6
Location: Russia
Anatoly 27 Sep 2005, 13:25
Sorry, forgot to mention: my systyem is
WIndows XP Prof x64 on AMD Athlon64 3000+ Venice
Post 27 Sep 2005, 13:25
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 27 Sep 2005, 14:25
As the name says, proc32.inc is designed for 32 bit. The proc64.inc is not finished yet, and so I have not yet made it available to the public.
Post 27 Sep 2005, 14:25
View user's profile Send private message Visit poster's website Reply with quote
Anatoly



Joined: 23 Sep 2005
Posts: 6
Location: Russia
Anatoly 27 Sep 2005, 15:08
Thank you Tomasz, but how could I solve this problem? Only wait for new version? Sorry for time you spent on me
Post 27 Sep 2005, 15:08
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 27 Sep 2005, 15:57
You can construct the procedure manually (also depending on the calling convention you want to use to call it), using the pure labels and standard instructions only.

If you want some example, please specify, how do you plan to call your procedures.
Post 27 Sep 2005, 15:57
View user's profile Send private message Visit poster's website Reply with quote
Anatoly



Joined: 23 Sep 2005
Posts: 6
Location: Russia
Anatoly 27 Sep 2005, 17:25
Yes I already used this way with pure labels, but i got error 'illegal instruction' at the line
'export 'testdll64.DLL',ForwardStepTruncated,'ForwardStepTruncated' '... So I cannot export my so-called 'procedure'! If you'll be so kind, here is my code example... I plan to call fast and optimized DLL procedure from a Visual Basic 6 program... [It has to do with signal propagation in a neural network... Written in assembler DLL function works with defined in VB program's memory array, and writes calculations in the another array. Pointers to this array (and some other params) are stored on the stack, and further passed to this procedure ] How can I get this code to compile?? Thanks in advance!



format PE64 GUI dll
entry DllEntryPoint

section '.code' code readable executable



DllEntryPoint: ; hinstDLL,fdwReason,lpvReserved
mov rax,0
ret


ForwardStepTruncated:
;!!! My procedure sarts here!
;here stack parameters
mNet equ rbp+16
dt_ptr equ rbp+24
V equ rbp+24
;........................
dt_sent equ r14
;prolog
push rbp
mov rbp,rsp
;end prolog
finit
fld1

mov rax,[dt_ptr]
mov i,0
mov dt_sent,rax
Next_i:
;.......
;.......
cmp rax,i
jne Next_i

mov rax,1
ret
;ForwardStepTruncated endp

section '.edata' export data readable

export 'testdll64.DLL',ForwardStepTruncated,'ForwardStepTruncated'


section '.reloc' fixups data discardable
Post 27 Sep 2005, 17:25
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8367
Location: Kraków, Poland
Tomasz Grysztar 27 Sep 2005, 17:54
You have to include export.inc to have the "export" macro. It is bitness neutral, so you can use it with 64-bit PEs aswell.

The macro packages that can be used with both PE and PE64 don't have the "32"/"64" at the end of names, like export.inc; the ones that can be used with Win32 PE files end with "32", like import32.inc and proc32.inc. I will add their equivalents for 64-bits in the future updates of the fasm for Windows package (the package may get updated with changed includes/examples even when the version of assembler stays the same).
Post 27 Sep 2005, 17:54
View user's profile Send private message Visit poster's website Reply with quote
Anatoly



Joined: 23 Sep 2005
Posts: 6
Location: Russia
Anatoly 27 Sep 2005, 18:06
Thank you very much,Tomasz! I was really stupid! Wish you good luck, keep it real Smile
Post 27 Sep 2005, 18:06
View user's profile Send private message Reply with quote
Reverend



Joined: 24 Aug 2004
Posts: 408
Location: Poland
Reverend 27 Sep 2005, 18:10
By the way: you have something else wrong surely. Here:
Code:
mov i,0 
...
cmp rax,i    
What is that 'i' and shouldn't it be enclosed within aquare brackets '[]'?
Post 27 Sep 2005, 18:10
View user's profile Send private message Visit poster's website Reply with quote
Anatoly



Joined: 23 Sep 2005
Posts: 6
Location: Russia
Anatoly 27 Sep 2005, 18:33
2 Reverend:
Thanks, i published not all code i have written Very Happy This junk was only for illustrating!
But u're right, i missed brackets with i Very Happy
Post 27 Sep 2005, 18:33
View user's profile Send private message Reply with quote
alorent



Joined: 05 Dec 2005
Posts: 221
alorent 20 Mar 2006, 12:35
Hello Anatoly,

Did you manage to create a 64-bit DLL?

I have been trying with no success. Even I could compile and export funtions in my 64-bit DLL, Windows x64 says invalid windows image for my DLL.

If someone could copy-paste the code to create the most basic DLL for x64 I will be really happy Smile

Thanks.
Post 20 Mar 2006, 12:35
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.