flat assembler
Message board for the users of flat assembler.

Index > Windows > invoke mydll.myfunc, namespace in imports

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 19 Apr 2022, 07:58
is there a way to give namespaces to imported functions,

like in the title?
Post 19 Apr 2022, 07:58
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4121
Location: vpcmpistri
bitRAKE 19 Apr 2022, 08:17
Did you try like:
Code:
import mydll, \
  mydll.myfunc, 'myfunc'    
... or intend something else?

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 19 Apr 2022, 08:17
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 19 Apr 2022, 08:21
i didn't tryed that .

i tryed this:
Code:
mydll:
import Mydll, .myfunc,'myfunc'

    


the best way to do it should be like above, but don't work cause i don't get how import is implemented.

the label before import is good because it lets the coder change the namespace without changing anything in the import section. good for fast switch between libs
Post 19 Apr 2022, 08:21
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4121
Location: vpcmpistri
bitRAKE 19 Apr 2022, 08:22
I agree - there could be a better way. Would need to change import macro though.

I've done something similar for fasmg, because I want to not type "invoke". Imagine a similar wrapper could be created for fasm.
Post 19 Apr 2022, 08:22
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1052
Location: Russia
macomics 19 Apr 2022, 12:20
IMPORT32.INC
Code:
macro import name,[label,string]
 { common
    rb (- rva $) and 3
    if defined name#.referred
     name#.lookup:
   forward
; 1 {
     if used label
       label label at name#label
     end if
     if used name#label
; }
      if string eqtype ''
       local _label
       dd RVA _label
      else
       dd 80000000h + string
      end if
     end if
   common
     if $ > name#.lookup
      name#.redundant = 0
      dd 0
     else
      name#.redundant = 1
     end if
     name#.address:
   forward
     if used name#label ; <---- 2
      if string eqtype ''
       name#label dd RVA _label ; <---- 3
      else
       name#label dd 80000000h + string ; <---- 4
      end if
     end if
   common
     if ~ name#.redundant
      dd 0
     end if
   forward
     if used name#label & string eqtype ''; <---- 5
     _label dw 0
            db string,0
            rb RVA $ and 1
     end if
   common
    end if }    
Also in IMPORT64.INC. Total of 5 changes
Post 19 Apr 2022, 12:20
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4354
Location: Now
edfed 19 Apr 2022, 19:36
with last version of fasm? i tryed with 1.70.03 and it gets an error with getModuleHandle in the first modification (label label at name#label)
Post 19 Apr 2022, 19:36
View user's profile Send private message Visit poster's website Reply with quote
macomics



Joined: 26 Jan 2021
Posts: 1052
Location: Russia
macomics 19 Apr 2022, 20:13
I didn't invent the names of arguments for standard macros. I actually rewrote them for myself a long time ago and do not use them because I have Linux.

edfed wrote:
i tryed with 1.70.03 and it gets an error with getModuleHandle in the first modification (label label at name#label)

Code:
label label dword at name#label    


Description: Everything works. I'm too lazy to type for x64.
Download
Filename: win32.asm
Filesize: 1.72 KB
Downloaded: 272 Time(s)

Post 19 Apr 2022, 20:13
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.