Click here to Skip to main content
15,922,696 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralProgram entry point - again Pin
Don Miguel16-Feb-02 8:03
Don Miguel16-Feb-02 8:03 
GeneralRe: Program entry point - again Pin
Joaquín M López Muñoz16-Feb-02 8:27
Joaquín M López Muñoz16-Feb-02 8:27 
GeneralRe: Program entry point - again Pin
Don Miguel16-Feb-02 21:30
Don Miguel16-Feb-02 21:30 
GeneralRe: Program entry point - again Pin
Michael Dunn16-Feb-02 9:22
sitebuilderMichael Dunn16-Feb-02 9:22 
GeneralRe: Program entry point - again Pin
Don Miguel16-Feb-02 21:27
Don Miguel16-Feb-02 21:27 
GeneralRe: Program entry point - again Pin
Paul M Watt16-Feb-02 21:37
mentorPaul M Watt16-Feb-02 21:37 
GeneralRe: Program entry point - again Pin
Don Miguel16-Feb-02 21:42
Don Miguel16-Feb-02 21:42 
GeneralRe: Program entry point - again Pin
Paul M Watt16-Feb-02 22:30
mentorPaul M Watt16-Feb-02 22:30 
In order to get that to work, your entry point function will need to be a static function of the class, because your class will not yet be initialized when your program starts up.

Then you will have to find the compiled symbol for that static class function and set this into the the entry-point symbol field of the ouput category on the linker page of Project settings.

Finally you will need to initialize the C/C++ runtime library yourself if you plan on using printf, cout, the string functions and things like this. You should be able to find some articles in MSDN or on the internet that explain how to do this.

Here is a sample program that I wrote to test this:

<br />
#include "stdafx.h"<br />
<br />
class entry<br />
{<br />
public:<br />
	static int point()<br />
	{<br />
		// initialize the c_runtime here.<br />
	        return 0;<br />
	}<br />
<br />
};<br />
<br />
// main is now useless, nobody calls it, you do not even need it to compile your program.<br />
int main(int argc, char* argv[])<br />
{<br />
	entry::point();<br />
<br />
	printf("Hello World!\n");<br />
	return 0;<br />
}<br />


The entry point that I used was this: ?point@entry@@SAHXZ, I found it in the disassempbly when I called entry::point from main before I reset the entry point.

If you have any more questions feel free to ask.
GeneralRe: Program entry point - again Pin
Don Miguel16-Feb-02 22:47
Don Miguel16-Feb-02 22:47 
GeneralRe: Program entry point - again Pin
Rick York16-Feb-02 23:06
mveRick York16-Feb-02 23:06 
GeneralRe: Program entry point - again Pin
Don Miguel16-Feb-02 23:13
Don Miguel16-Feb-02 23:13 
GeneralRe: Program entry point - again Pin
Paul M Watt16-Feb-02 23:12
mentorPaul M Watt16-Feb-02 23:12 
GeneralRe: Program entry point - again Pin
Don Miguel16-Feb-02 23:28
Don Miguel16-Feb-02 23:28 
GeneralRe: Program entry point - again Pin
Tim Deveaux17-Feb-02 6:58
Tim Deveaux17-Feb-02 6:58 
GeneralProgram entry point Pin
Don Miguel16-Feb-02 7:40
Don Miguel16-Feb-02 7:40 
GeneralRe: Program entry point Pin
Tim Deveaux16-Feb-02 14:08
Tim Deveaux16-Feb-02 14:08 
GeneralCFileDialog question(s) Pin
User 842016-Feb-02 7:02
User 842016-Feb-02 7:02 
GeneralRe: CFileDialog question(s) Pin
Ravi Bhavnani16-Feb-02 7:17
professionalRavi Bhavnani16-Feb-02 7:17 
GeneralRe: CFileDialog question(s) Pin
Joaquín M López Muñoz16-Feb-02 7:14
Joaquín M López Muñoz16-Feb-02 7:14 
GeneralRe: CFileDialog question(s) Pin
PJ Arends16-Feb-02 7:28
professionalPJ Arends16-Feb-02 7:28 
GeneralRe: CFileDialog question(s) Pin
User 842016-Feb-02 7:58
User 842016-Feb-02 7:58 
GeneralRe: CFileDialog question(s) Pin
Rick York16-Feb-02 7:41
mveRick York16-Feb-02 7:41 
GeneralRe: CFileDialog question(s) Pin
Shog916-Feb-02 14:29
sitebuilderShog916-Feb-02 14:29 
QuestionDisplaying Icons in CButton ?????? Pin
16-Feb-02 6:30
suss16-Feb-02 6:30 
AnswerRe: Displaying Icons in CButton ?????? Pin
Mazdak16-Feb-02 6:38
Mazdak16-Feb-02 6:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.