You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by Milan Tomic <mi...@setcce.org> on 2004/06/07 16:48:19 UTC

I give up :>

	I've been trying to use XSEC in Win32 DLL project, using VC6,
but it is not possible. I've created Win32 DLL project and added only
this line in myDLL.cpp file:

#include <xsec/utils/XSECPlatformUtils.hpp>

	XSECPlatformUtils.hpp includes XSECDefs.hpp, and it contains
those lines:

#if defined (_WIN32)
#	if defined (_DEBUG)
#		include <afx.h>
#		include <crtdbg.h>
#	else
#		define WIN32_LEAN_AND_MEAN
#		include <windows.h>
#	endif
#	include <xsec/framework/XSECW32Config.hpp>
#else
#	include <xsec/framework/XSECConfig.hpp>
#endif

	It includes afx.h, and afx.h includes MFC. Release configuration
builds, but Debug fails. I couldn't find a way to build it and I've
tried everything (include MFC, use different run-times...).

Best regards,
Milan

RE: I give up :>

Posted by Milan Tomic <mi...@setcce.org>.
Hello Berin,

	This is the error message:

Generating Code...
Linking...
nafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined
in MyApp.obj
nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator
new(unsigned int)" (??2@YAPAXI@Z) already defined in
Xerces250D.lib(Win32PlatformUtils.obj)
nafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined
in MyApp.obj; second definition ignored
nafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator
new(unsigned int)" (??2@YAPAXI@Z) already defined in
Xerces250D.lib(Win32PlatformUtils.obj); second definition ignored
   Creating library ..\..\Build\myapp\Debug/MyAppD.lib and object
..\..\Build\myapp\Debug/MyAppD.exp
..\..\Build\myapp\Debug/MyAppD.dll : fatal error LNK1169: one or more
multiply defined symbols found
Error executing link.exe.

	You can simply emulate problem by creating new Win32 DLL project
and adding that include line I've explained in previous post.

Thank you,
Milan


> -----Original Message-----
> From: Berin Lautenbach [mailto:berin@wingsofhermes.org] 
> Sent: Tuesday, June 08, 2004 12:52 PM
> To: security-dev@xml.apache.org
> Subject: Re: I give up :>
> 
> 
> Milan,
> 
> What's the error message?
> 
> Cheers,
> 	Berin
> 
> 
> Milan Tomic wrote:
> 
> > 
> >         I've been trying to use XSEC in Win32 DLL project, 
> using VC6,
> > but it is not possible. I've created Win32 DLL project and 
> added only 
> > this line in myDLL.cpp file:
> > 
> > #include <xsec/utils/XSECPlatformUtils.hpp>
> > 
> >         XSECPlatformUtils.hpp includes XSECDefs.hpp, and it contains
> > those lines:
> > 
> > #if defined (_WIN32)
> > #       if defined (_DEBUG)
> > #               include <afx.h>
> > #               include <crtdbg.h>
> > #       else
> > #               define WIN32_LEAN_AND_MEAN
> > #               include <windows.h>
> > #       endif
> > #       include <xsec/framework/XSECW32Config.hpp>
> > #else
> > #       include <xsec/framework/XSECConfig.hpp>
> > #endif
> > 
> >         It includes afx.h, and afx.h includes MFC. Release 
> > configuration
> > builds, but Debug fails. I couldn't find a way to build it and I've 
> > tried everything (include MFC, use different run-times...).
> > 
> > Best regards,
> > Milan
> > 
> 



RE: I give up :>

Posted by Milan Tomic <mi...@setcce.org>.
Berin,

	VC6 ignores everyhing before ' #include "stdafx.h" ' line. You
can put anything there, including "JHZIGJHBKJBJHG" text, and it will
compile. It simply ignores it. :>

Best regards,
Milan


> -----Original Message-----
> From: Berin Lautenbach [mailto:berin@wingsofhermes.org] 
> Sent: Friday, June 18, 2004 12:11 PM
> To: security-dev@xml.apache.org
> Subject: Re: I give up :>
> 
> 
> I've been thinking for a while that I should have a separate "memory 
> debug" build of xsec and go back to non-mfc for normal debug.
> 
> Having said that, I've found that ordering headers generally gets me 
> around the problems (e.g. putting your include below as the first 
> include works for me in the DLL scenario with vc6.0).  The following 
> works for me (or at least compiles :>.)
> 
> // test.cpp : Defines the entry point for the DLL application. //
> 
> 
> #include <xsec/utils/XSECPlatformUtils.hpp>
> 
> #include "stdafx.h"
> 
> BOOL APIENTRY DllMain( HANDLE hModule,
>                         DWORD  ul_reason_for_call,
>                         LPVOID lpReserved
> 					 )
> {
>      return TRUE;
> }
> 
> Cheers,
> 	Berin
> 
> Milan Tomic wrote:
> 
> > 	Thank you, Scott, for your response, but _AFXDLL didn't 
> solved my 
> > problem.
> > 
> > 	Berin, I really think we should change XSECDefs.hpp. I 
> belive it 
> > should include <windows.h> instead of <afx.h>, like Xerces 
> and Xalan 
> > does. Otherwise, any usage of XSEC in non-MFC projects (like Win32 
> > DLL) results in this error:
> > 
> > c:\program files\microsoft visual 
> > studio\vc98\mfc\include\afxv_w32.h(14)
> > : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps
> > must not #include <windows.h>
> > 
> > 	This error could be reproduced by creating Win32 DLL 
> project and 
> > adding this line into main .cpp file (containing DllMain()):
> > 
> > #include <xsec/utils/XSECPlatformUtils.hpp>
> > 
> > Best regards,
> > Milan
> > 
> > 
> > 
> > 
> >>-----Original Message-----
> >>From: Scott Cantor [mailto:cantor.2@osu.edu]
> >>Sent: Tuesday, June 08, 2004 3:42 PM
> >>To: security-dev@xml.apache.org
> >>Subject: RE: I give up :>
> >>
> >>
> >>>It includes afx.h, and afx.h includes MFC. Release configuration
> >>>
> >>>>builds, but Debug fails. I couldn't find a way to build
> >>
> >>it and I've
> >>
> >>>>tried everything (include MFC, use different run-times...).
> >>
> >>Try defining _AFXDLL in the project settings. I've always had
> >>to do that to get my Debug builds to work.
> >>
> >>-- Scott
> >>
> > 
> > 
> > 
> > 
> > 
> 



Re: I give up :>

Posted by Berin Lautenbach <be...@wingsofhermes.org>.
I've been thinking for a while that I should have a separate "memory 
debug" build of xsec and go back to non-mfc for normal debug.

Having said that, I've found that ordering headers generally gets me 
around the problems (e.g. putting your include below as the first 
include works for me in the DLL scenario with vc6.0).  The following 
works for me (or at least compiles :>.)

// test.cpp : Defines the entry point for the DLL application.
//


#include <xsec/utils/XSECPlatformUtils.hpp>

#include "stdafx.h"

BOOL APIENTRY DllMain( HANDLE hModule,
                        DWORD  ul_reason_for_call,
                        LPVOID lpReserved
					 )
{
     return TRUE;
}

Cheers,
	Berin

Milan Tomic wrote:

> 	Thank you, Scott, for your response, but _AFXDLL didn't solved
> my problem.
> 
> 	Berin, I really think we should change XSECDefs.hpp. I belive it
> should include <windows.h> instead of <afx.h>, like Xerces and Xalan
> does. Otherwise, any usage of XSEC in non-MFC projects (like Win32 DLL)
> results in this error:
> 
> c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14)
> : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps
> must not #include <windows.h>
> 
> 	This error could be reproduced by creating Win32 DLL project and
> adding this line into main .cpp file (containing DllMain()):
> 
> #include <xsec/utils/XSECPlatformUtils.hpp>
> 
> Best regards,
> Milan
> 
> 
> 
> 
>>-----Original Message-----
>>From: Scott Cantor [mailto:cantor.2@osu.edu] 
>>Sent: Tuesday, June 08, 2004 3:42 PM
>>To: security-dev@xml.apache.org
>>Subject: RE: I give up :>
>>
>>
>>>It includes afx.h, and afx.h includes MFC. Release configuration
>>>
>>>>builds, but Debug fails. I couldn't find a way to build 
>>
>>it and I've
>>
>>>>tried everything (include MFC, use different run-times...).
>>
>>Try defining _AFXDLL in the project settings. I've always had 
>>to do that to get my Debug builds to work.
>>
>>-- Scott
>>
> 
> 
> 
> 
> 

RE: I give up :>

Posted by Milan Tomic <mi...@setcce.org>.
	Thank you, Scott, for your response, but _AFXDLL didn't solved
my problem.

	Berin, I really think we should change XSECDefs.hpp. I belive it
should include <windows.h> instead of <afx.h>, like Xerces and Xalan
does. Otherwise, any usage of XSEC in non-MFC projects (like Win32 DLL)
results in this error:

c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14)
: fatal error C1189: #error :  WINDOWS.H already included.  MFC apps
must not #include <windows.h>

	This error could be reproduced by creating Win32 DLL project and
adding this line into main .cpp file (containing DllMain()):

#include <xsec/utils/XSECPlatformUtils.hpp>

Best regards,
Milan



> -----Original Message-----
> From: Scott Cantor [mailto:cantor.2@osu.edu] 
> Sent: Tuesday, June 08, 2004 3:42 PM
> To: security-dev@xml.apache.org
> Subject: RE: I give up :>
> 
> 
> > It includes afx.h, and afx.h includes MFC. Release configuration
> > > builds, but Debug fails. I couldn't find a way to build 
> it and I've
> > > tried everything (include MFC, use different run-times...).
> 
> Try defining _AFXDLL in the project settings. I've always had 
> to do that to get my Debug builds to work.
> 
> -- Scott
> 



RE: I give up :>

Posted by Scott Cantor <ca...@osu.edu>.
> It includes afx.h, and afx.h includes MFC. Release configuration 
> > builds, but Debug fails. I couldn't find a way to build it and I've 
> > tried everything (include MFC, use different run-times...).

Try defining _AFXDLL in the project settings. I've always had to do that to
get my Debug builds to work.

-- Scott


Re: I give up :>

Posted by Berin Lautenbach <be...@wingsofhermes.org>.
Milan,

What's the error message?

Cheers,
	Berin


Milan Tomic wrote:

> 
>         I've been trying to use XSEC in Win32 DLL project, using VC6, 
> but it is not possible. I've created Win32 DLL project and added only 
> this line in myDLL.cpp file:
> 
> #include <xsec/utils/XSECPlatformUtils.hpp>
> 
>         XSECPlatformUtils.hpp includes XSECDefs.hpp, and it contains 
> those lines:
> 
> #if defined (_WIN32)
> #       if defined (_DEBUG)
> #               include <afx.h>
> #               include <crtdbg.h>
> #       else
> #               define WIN32_LEAN_AND_MEAN
> #               include <windows.h>
> #       endif
> #       include <xsec/framework/XSECW32Config.hpp>
> #else
> #       include <xsec/framework/XSECConfig.hpp>
> #endif
> 
>         It includes afx.h, and afx.h includes MFC. Release configuration 
> builds, but Debug fails. I couldn't find a way to build it and I've 
> tried everything (include MFC, use different run-times...).
> 
> Best regards,
> Milan
>