-
July 12th, 2016, 07:10 AM
#1
multiple projects
going through an application which has multiple projects in it, that is looking in it source code through visual studio...
All the projects have their main.cpp or core.cpp file and they all do have their void WINAPI _entrypoint()
or simply void WINAPI entrypoint() functions
1)my question is how do multiple projects communicates and when and how is control passed from one to the another?
how does the windows OS know that is has to start from this particular WINAPI entrypoint()?
actually I'm trying to lay the track of the app, to find it starting point and walk through it to the end...
-
July 12th, 2016, 07:49 AM
#2
Re: multiple projects
I'm not sure I fully understand to what you are referring. The names of files are irrelevant to their purpose. A solution consists of one or more projects with each project consisting of one of more source files.
For each non-mfc project, these are either an .exe or a .dll. For a .dll, only one source file may have DllMain() entry point - but this is not required. For an .exe, there are two entry points that may be defined. For a console application this is main(). For a windows program this is WinMain(). A project may contain both main() and WinMain() entry points. Which one is used is determined by the project options. But within a project there can only be one of each and must contain the one for the type of project.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
July 12th, 2016, 07:52 AM
#3
Re: multiple projects
Originally Posted by TheLionKing
going through an application which has multiple projects in it, that is looking in it source code through visual studio...
What do you mean by "an application which has multiple projects in it"?
Perhaps, you mean "solution which has multiple projects in it"? Or not?
Victor Nijegorodov
-
July 12th, 2016, 08:27 AM
#4
Re: multiple projects
I meant that Master VictorN, a solution which has multiple projects in it..yes...does it make it my question clearer? can something more be added to what Master 2kaud said?
to confirm was 2kaud said, yes in each project there is one WINAPI entrypoint()...I know for sure that the individual projects makes up one application in the end, they are all part of the same solution...
so at least, one "SUPER" main entry point is at least needed right? is there no way to specify or know that?
Last edited by TheLionKing; July 12th, 2016 at 08:33 AM.
-
July 12th, 2016, 09:47 AM
#5
Re: multiple projects
Victor Nijegorodov
-
July 12th, 2016, 10:08 AM
#6
-
July 12th, 2016, 10:21 AM
#7
Re: multiple projects
so at least, one "SUPER" main entry point is at least needed right? is there no way to specify or know that?
I'm not sure what you mean by 'Super' main entry point. The functions main(), WinMain(), DllMain() are 'hard wired' and fixed into the system and can't be changed. They need to be used as stipulated.
All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!
C++23 Compiler: Microsoft VS2022 (17.6.5)
-
July 12th, 2016, 10:29 AM
#8
Re: multiple projects
I'm not sure what you mean by 'Super' main entry point. The functions main(), WinMain(), DllMain() are 'hard wired' and fixed into the system and can't be changed. They need to be used as stipulated
What I meant was that, the whole application at the end of the day must start from somewhere...since there are many projects with their starting points, where does the whole app start from or which project start the whole application rolling...but I just learnt reading that it seems that can be specified explicitely in configurations...
-
July 12th, 2016, 10:51 AM
#9
Re: multiple projects
Originally Posted by TheLionKing
What I meant was that, the whole application at the end of the day must start from somewhere...since there are many projects with their starting points, where does the whole app start from or which project start the whole application rolling...but I just learnt reading that it seems that can be specified explicitely in configurations...
A solution is just a collection of projects - nothing more nothing less. Just because a solution has a set of projects in it, doesn't mean they interact with each other at runtime.
-
July 12th, 2016, 11:53 AM
#10
Re: multiple projects
that is very right too Arjay....
-
July 13th, 2016, 02:48 AM
#11
Re: multiple projects
A reason for bundling a number of projects into a single solution might be the EXEs are to depend on the same bunch of static/dynamic libraries, so all those would be built in a single whiff, and maybe a test suite(s) to be run as well to test the core functionality as much as possible.
Best regards,
Igor
-
July 13th, 2016, 03:08 AM
#12
Re: multiple projects
Originally Posted by TheLionKing
how does the windows OS know that is has to start from this particular WINAPI entrypoint()?
The entrypoint is placed into EXE's PE header by linker, so Windows always knows for sure where to start from.
Linker Option: /ENTRY (Entry-Point Symbol)
Typically, entrypoint is unambiguously stipulated by project type. However, sometimes it has to be specified explicitly to circumvent some CRT features. And sometimes it is deliberately specified for some reason having nothing common with conventional programming culture. Like showing how cool I am and what sort of weird stunts I've learnt.
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|