The MASM Forum

General => The Campus => Topic started by: markallyn on October 17, 2017, 01:13:09 AM

Title: setting the entry point in visual studio community 2017
Post by: markallyn on October 17, 2017, 01:13:09 AM
Hello everyone,

I have two procs structured as follows:
Quote

.code
main PROC
.
call IntegerAdd_
.
main ENDP

IntegerAdd_ PROC
.
.
.
IntegerAdd_ ENDP
END

When the above code is assembled, the linkier compains that there is an unresolved external symbol mainCRTStartup.  If I change "main" in the first PROC to "mainCRTStartup", everything works as expected.  Mind you, I am building this code with Visual Studio Community 2017.  The 2017 IDE seems to not let me set the entry point to anything other than mainCRTStartup. 

Could someone explain what is going on here? 

Thanks,
Mark Allyn
Title: Re: setting the entry point in visual studio community 2017
Post by: hutch-- on October 17, 2017, 01:19:12 AM
Mark,

See if this linker option does what you need.

/ENTRY:main
Title: Re: setting the entry point in visual studio community 2017
Post by: markallyn on October 17, 2017, 01:23:29 AM
Hello everyone,

If I work off the command line, however, and set the the entry point with the linker option /ENTRY:main, all proceeds well.  If I don't use the ENTRY option, then the linker wants to find mainCRTStartup.  So, from this I conclude that the VS 2017 IDE:

1.  Defaults to the insertion of mainCRTStartup as the entry point, and worse,
2.  Will NOT allow users to select their own entry points.

Am I correct in this conclusion?

Regards,
Mark Allyn
Title: Re: setting the entry point in visual studio community 2017
Post by: markallyn on October 17, 2017, 01:26:36 AM
Good morning, Hutch,

Your response to my initial post came in while I was writing my second post.  As you can see, I got to the same place you did.  But, still, am I right that VS won't allow users to pick their own entry points?  On one of MSFT's pages I read that they really don't like people picking their own and claim that they can get into all sorts of trouble if they do.

Thanks,
Mark
Title: Re: setting the entry point in visual studio community 2017
Post by: aw27 on October 17, 2017, 02:00:31 AM
This has been answered in another post from you yesterday.
It allows changing the EntryPoint from the IDE but you may need to set Yes (/NODEFAULTLIB). If you have C/C++ files in the project remove them to make all easy.
Title: Re: setting the entry point in visual studio community 2017
Post by: nidud on October 17, 2017, 02:13:58 AM
deleted
Title: Re: setting the entry point in visual studio community 2017
Post by: markallyn on October 17, 2017, 02:48:27 AM
Hello everyone,

OK, I finally figured out how to use the VS IDE to set the entry point to one of my choosing.  Here's how to do it for those who don't know.  Go to the Solution Explorer.  Click on the project.  Go to the properties line and click it.  Go to the linker line.  Click it and then click "Advanced".  First line is the entry point option.  Go to the far right and you will see a small box with a downward pointing error.  Click it and it will give you an <Edit..> option.  Click it and a dialog box opens.  In the edit box type in whatever name you want as the entry point.  Then click OK.  Now the last step is absolutely crucial, and it is what I had not been doing.  After the dialog box closes you MUST hit the "enter" key.  Unless you do this, your entry point will not be saved.

Case closed.  But still, highly amusing.

Regards,
Mark