[python-win32] win32ui and resources for dialogs

Mark Hammond mhammond at skippinet.com.au
Wed Jan 10 23:45:44 CET 2007


> Hi Mark
>
> I made the following change:
>
>
> -----------------------
> // @pymethod |PyCDialog|CreateWindow|Create a modeless window for the
> dialog box.
> static PyObject *ui_dialog_create_window( PyObject *self,
> PyObject *args )
> {
>     AFX_MANAGE_STATE(AfxGetStaticModuleState());
>
>     PyObject *obParent = NULL;
>     CWnd *pParent = NULL;
>
>
>     // @pyparm <o PyCWnd>|obParent|None|The parent window for
> the new window
>     if (!PyArg_ParseTuple(args,"|O:CreateWindow", &obParent))
>         return NULL;
> .
> .
> .
> .
> ----------------
>
> after adding AFX_MANAGE_STATE(AfxGetStaticModuleState());
> i get the following link-errors:
>
> ----
> Linking...
> mfcs71.lib(dllmodul.obj) : error LNK2005: _DllMain at 12 already
> defined in
> dllmain.obj

That macro is attempting to pull in the static version of MFC, which is
causing the failure.  We link to the DLL version of MFC.  Although they are
a bit vague, things I read on the web imply pythonwin does *not* need this,
as it is a full blown MFC DLL (ie, an 'extension DLL').  Either way, the
fact AFX_MANAGE_STATE tries to drag in the MFC static library seems a
deal-breaker.  I'm afraid I'm out of time to dig much more into this.

Cheers,

Mark



More information about the Python-win32 mailing list