locked
Why does 64-bit MASM not accept an entry point address on the END directive? RRS feed

  • Question

  • In 32-bit MASM, the END directive optionally allows us to set the entry point by specifying an address ( http://msdn.microsoft.com/en-us/library/vstudio/wxy1fb5k(v=vs.120).aspx ).  But in 64-bit MASM, placing an address after the END directive is treated as a syntax error.  I don't see any documentation on this difference, but I have experienced it and have seen a few mentions of it by others. 

    Of course, we can work around this behavior by specifying the entry point for the linker (Project Properties | Configuration Properties | Linker | Advanced | Entry Point). But this approach means that, if the name of the entry point changes in the source code, it has to be changed also in the linker options.

    My question is: Why is the ability to specify an entry point on the END directive not present in ml64?  I'm sure there must be a good reason.  I'm very interested in knowing why.

    Thanks.


    • Edited by kengr Monday, March 10, 2014 8:37 PM
    Monday, March 10, 2014 8:36 PM

All replies

  • Hi,

    According to your description, you want to know why you can not use END directives for entry point address for 64bit MASM. Actually I can not tell the reason, just as why visual studio express version can not support for MFC. The functionality depends on its design.

    As far as I know, in order to compile the 64-version, you need to invoke ml64 like this :

    ml64XXX.asm /link /subsystem:windows /defaultlib:kernel32.lib /defaultlib:user32.lib /entry:main

    assuming kernel32.lib and user32.lib reside in the same directory as ml64.exe, and where XXX is the name of your assembly file. You can add the option /entry:main to meet the reuqirement of link.exe.

    Also, you can set the entrypoint through Configuration Properties > Linker > Advanced > EntryPoint.

    More about MASM, you can also get help from MASM Forum for more suggestions.

    By the way, this link may be helpful for you to understand its architecture.

    Introduction to x64 Assembly

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, March 12, 2014 6:24 AM
  • May Wang -

    Thanks for your reply.

    As I said in my original post, I can easily work around the change in behavior of the END directive by setting the entry point in Project Properties | Configuration Properties | Linker | Advanced | Entry Point.  That's what I have been doing.  If the entry point name has to change, then I go change it in the properties.  It's less convenient that just editing the END directive (as is possible in 32-bit MASM), but it works.

    I am aware of the Intel x64 intro document.  I am not looking for a tutorial on 64-bit MASM programming or x64 architecture.  I am aware of the MASM32 forum as well.

    I am looking for the technical reason why the syntax of the MASM END directive is different between 32-bit MASM and 64-bit MASM.  I have seen the issue mentioned (and complained about) in various places, but no one seems to know why the syntax is different.  I asked the question here at MSDN, hoping that someone at MSFT might know the technical reason for the difference.


    • Edited by kengr Friday, April 22, 2016 4:34 PM fix typo
    Wednesday, March 12, 2014 3:33 PM
  • Hi,

    Thanks for your trust and support.

    Based on this issue, it is hard to explain the reason for me. Maybe because of my lack of knowledge. Hope others who know this well can join this topic to provide help for you.

    As my personal suggestion, I think you may spend some time to learn about its architecture then maybe you will know the reason.

    Thanks,

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 13, 2014 6:17 AM
  • May -

    Thanks for your reply. 

    I already understand the x64 architecture, but I don't see any technical reason why an entry point address would not be allowed on the END directive in the 64-bit assembler.  An entry point can be specified via the project properties in both 32-bit and 64-bit, and the concept of an entry point hasn't changed between the two architectures.  32-bit MASM accepts it on the END directive, while 64-bit MASM doesn't. This appears to be simply a syntax change between the two assemblers, not a fundamental change in what an entry point means.

    I'm sure there is some reason for making this change in syntax between 32-bit and 64-bit END directives, and I am very interested in knowing what that reason is.  I echo the hope that someone who knows the answer will reply.  This is not a blocking issue...I just like to understand the reasons behind changes like this.

    Thanks.

    Thursday, March 13, 2014 2:38 PM
  • Hello kengr,

    I have already escalated this thread to senior, I think they will give you professional support for this issue. Hope you can wait their replies with patience.

    Thanks for your trust again!

    Best Regards,

    May


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, March 14, 2014 7:08 AM
  • May -

    Thanks for your reply.  I will wait patiently.

    Friday, March 14, 2014 2:13 PM
  • Hi,

    From a support perspective this is really beyond what we can do here in the forums. If you cannot determine your answer here or on your own, consider opening a support case with us. Visit this link to see the various support options that are available to better meet your needs:  http://support.microsoft.com/default.aspx?id=fh;en-us;offerprophone.


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Jun Zh - MSFT Microsoft Online Community Support

    Sunday, March 16, 2014 11:33 PM