Re: [AD] Allegro 4.0.3rc1+ MFC, bug?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> I don't know how that would effect.

Read again the second error message. It seems that MSVC is complaining
because we declared WinMain() with C linkage before its own declaration of
the function with C linkage.

> No, there's no WinMain with MFC. I think that MFC declares is own WinMain.
> I neither have main() function.

Ok, you need to teach me how MFC copes with the entry point: does it
explicitly forbid main() and WinMain() or are they optional? Is there a
replacement or does it automatically invoke a top-level class like in Java?

You cannot declare your own WinMain() function. We are in Windows, so there isn't main.

Ok, this is how MFC works: you create a new class derived from CWinApp. This class represents an application. The method InitInstance() is automatically called by MFC, and there you do all the initialization. You declare a global object of the class you have just created, and just some magic macros to let MFC know about this object. In fact I don't see any limitation on how many application objects you can have.

However, in one of my apps, all the functions that need allegro are declared in a sepparate c++ file. I only include MFC headers for interaction with the rest of the program (for example, I need a HWND for win_set_window() ), and made some calls to AfxMessageBox(), exactly the same as the WinAPI's MessageBox().

I'm not an expert in MFC, so I don't know how all this is implemented (thought MFC source code is available).

What I think the problem is is that allegro shouldn't declare WinMain if ALLEGRO_AND_MFC is defined, because MFC has it's own WinMain. And I think that's how it used to be.


_________________________________________________________________
Charla con tus amigos en línea mediante MSN Messenger: http://messenger.microsoft.com/es





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/