flat assembler
Message board for the users of flat assembler.

Index > Windows > Win64 NMake Project Example:

Author
Thread Post new topic Reply to topic
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 01 Jun 2009, 08:35
Code:
          Win64 Modular FASM Project Example


Concepts Demonstraited:

       - modular NMake build process
       - inline NMake file
 - section positioning within executable
     - passing commands to linker from object


Project Structure:

      Makefile - builds the project

   FileA.exe +-- FileA.obj +-- FileA.fasm
                |             +-- FileA.finc
                |
           +-- FileB.obj +-- FileB.fasm
                |             +-- FileB.finc
                |
           +-- FileC.res +-- FileC.rc
                                +-- FileC.ico
                               +-- FileC.xml (inlined)

 ReadMe.txt - (this file, silly - use 8 for tab and courier font)
    VSGo.cmd - execute for prompt if Visual Studio 9.0 is installed.


Requirements:

   - latest FASM
       - Windows x64 Platform SDK
    (or at least \bin & \lib directories)

   It is assumed that sufficent build environment is already established to
    use MSVC. Another linker and resource compiler could be used with NMake,
    but that seems rather silly. NMake will need to be in the environment
       variable %path% - project can be built by simply typing 'nmake' in the
    directory. Remove temporary files with "nmake clean".


Resources:

       FASM, http://www.flatassembler.net/
     NMAKE, http://msdn.microsoft.com/en-us/library/dd9y37ha.aspx
    LINK, http://msdn.microsoft.com/en-us/library/t2fck18t.aspx
     FDBG, http://fdbg.x86asm.net/



       bitRAKE, 2009.06.01


Challenges:

  - all source files can be inlined within makefile (yes, really)
    
Of course, all the same concepts apply equally well to Win32 programming.

* Update: corrected spelling mistake and pass commands to linker from object file (makefile becomes more general).


Description:
Download
Filename: NMake64.zip
Filesize: 4.44 KB
Downloaded: 701 Time(s)


_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 01 Jun 2009, 08:35
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 07 Jun 2009, 23:25
Another permutation of my horrible subclass example. This time using NMake and demonstraiting encapsulizaton of the main code. It seems using "/SUBSYSTEM:WINDOWS,6.00" forces the linker to use a dynamic /BASE - despite using a /BASE command line switch (wtf!). More investigation is needed to determine, why and how to bypass this feature?


Description: NMake example #2
Download
Filename: SubClass64.zip
Filesize: 6.75 KB
Downloaded: 695 Time(s)


_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 07 Jun 2009, 23:25
View user's profile Send private message Visit poster's website Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 26 Jan 2010, 07:49
bitRAKE wrote:
It seems using "/SUBSYSTEM:WINDOWS,6.00" forces the linker to use a dynamic /BASE - despite using a /BASE command line switch (wtf!). More investigation is needed to determine, why and how to bypass this feature?
ASLR? - in case you haven't already solved the problem (it's been a while Smile), try adding /FIXED:YES and/or /DYNAMICBASE:NO .

_________________
Image - carpe noctem
Post 26 Jan 2010, 07:49
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 26 Jan 2010, 17:26
Thank you - I was missing some of the default behavior.
Post 26 Jan 2010, 17:26
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 12 Sep 2020, 23:58
An update for VS2019 build tools and Win8, and conversion to fasmg.
https://github.com/bitRAKE/fasmg_playground/tree/master/win64/SubClass64

Edit: just realized this has been broken since my conversion to 64-bit ten years ago. Oddly, it gives the appearance of working. At the time I was being tricky with the parameter passing within the new version of COMCTL API - it greatly reduced the code for the sub-classing, but wasn't fully complete.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 12 Sep 2020, 23:58
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4082
Location: vpcmpistri
bitRAKE 17 Sep 2020, 03:11
It only took ten years.

Completely, fixed in this more advanced example:
https://github.com/bitRAKE/fasmg_playground/tree/master/win64/SubClass64.Adv

Some macro tools to make programming more concise. The code seems very intuitive to me at least. Rolling Eyes The next step is probably to rewrite MS COFF support in fasmg. Need full debug support, unwind support, etc. Been taking notes - not sure when that'll get off the ground though.

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 17 Sep 2020, 03:11
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:  


< 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.