Author Topic: A question for Habran/Nidud.  (Read 2106 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5654
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
A question for Habran/Nidud.
« on: July 10, 2016, 06:34:29 PM »
I was interested to see if HJWASM and Nidud's version can use the include files that Vasily designed. The libraries should be no problem as they are the same as normal Microsoft libraries as well as Pelle's libraries. With qWord's suggestion changing the "extern" to "externdef" the includes/libraries work OK with ML64.

Would either work with the format,


    externdef functionname:PROC
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

habran

  • Member
  • *****
  • Posts: 1170
    • uasm
Re: A question for Habran/Nidud.
« Reply #1 on: July 10, 2016, 07:54:27 PM »
It can work fine with call, however, invoke needs prototype
There is a difference between ML64 the macro invoke you are using and HJWasm invoke, because HJWasm checks parameters while the other one doesn't
Cod-Father

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5654
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: A question for Habran/Nidud.
« Reply #2 on: July 10, 2016, 08:33:05 PM »
What a shame, its a lot more work to produce an exhaustive list of prototypes. I gather the libraries would be no problem.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

habran

  • Member
  • *****
  • Posts: 1170
    • uasm
Re: A question for Habran/Nidud.
« Reply #3 on: July 10, 2016, 08:58:21 PM »
I can see that you world is upside down, where good is bad and bad is good, no wander why, we are upside down here in OZ, I have been here only 24 years, maybe not long enough to catch up that perception :biggrin:
It would be possible to make it work in bad way, however, I am not gonna do it 8)
I remember the scene from Groundhog Day when Phil (Bill Murray) says to Ned (Stephen Tobolowsky) : "I would love to have a cup of coffee with you, but I am not gonna do it."
Cod-Father

nidud

  • Member
  • *****
  • Posts: 1569
    • https://github.com/nidud/asmc
Re: A question for Habran/Nidud.
« Reply #4 on: July 10, 2016, 09:12:42 PM »
EXTRN or EXTERN is used to force inclusion of external modules so it works more like a link option than a proto type. It is mostly used to build modular libraries where the external symbol is not used in the current module.

nidud

  • Member
  • *****
  • Posts: 1569
    • https://github.com/nidud/asmc
Re: A question for Habran/Nidud.
« Reply #5 on: July 10, 2016, 09:36:06 PM »
Here's an example on how it works...

Code: [Select]
.386
.model flat, c

extrn foo: proc
extrn bar: proc ; force inclusion of bar.obj
;externdef bar: proc ; not included

.code
main:
call foo
ret

END main

build.bat:
Code: [Select]
asmc -coff foo.asm bar.asm
lib -out:extrn.lib foo.obj bar.obj
del *.obj

asmc -coff main.asm
link -map main.obj extrn.lib
del extrn.lib
del main.obj
del main.exe

type main.map
pause

map:
Code: [Select]
main

 Timestamp is 578232ce (Sun Jul 10 13:34:38 2016)

 Preferred load address is 00400000

 Start         Length     Name                   Class
 0001:00000000 0000000dH .text                   CODE

  Address         Publics by Value              Rva+Base     Lib:Object

 0001:00000000       _main                      00401000     main.obj
 0001:00000008       _foo                       00401008 f   extrn:foo.obj
 0001:0000000c       _bar                       0040100c f   extrn:bar.obj

 entry point at        0001:00000000

 Static symbols

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 5654
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: A question for Habran/Nidud.
« Reply #6 on: July 10, 2016, 11:21:15 PM »
It was more a comment that its easy enough to do a full set of include files for something as crude as ML64 as it has no type or size checking. Its not a problem for my generation as manual coding was normal but I do see that advantage of at least argument count checking for people who do not have that background. It was easy enough to get the argument count in STDCALL functions from the win32 libraries but the win64 libraries use a different notation so there is no an easy technique to get the argument count.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :biggrin:

rrr314159

  • Member
  • *****
  • Posts: 1382
Re: A question for Habran/Nidud.
« Reply #7 on: July 10, 2016, 11:47:44 PM »
I was interested to see if HJWASM and Nidud's version can use the include files that Vasily designed. The libraries should be no problem as they are the same as normal Microsoft libraries as well as Pelle's libraries. With qWord's suggestion changing the "extern" to "externdef" the includes/libraries work OK with ML64. Would either work with the format,

    externdef functionname:PROC

It can work fine with call, however, invoke needs prototype
There is a difference between ML64 the macro invoke you are using and HJWasm invoke, because HJWasm checks parameters while the other one doesn't

turn off the keyword "invoke" and use Vasily's invoke macro instead of the HJWasm invoke
I am NaN ;)