logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Doornbosch" <peter.doornbo...@gmail.com>
Subject Re: Visual C++ Assertion failed when using LOG4CXX_DECODE_CHAR macro in statically linked MFC project
Date Wed, 03 Dec 2008 09:38:45 GMT
Hi Jacob,


2008/12/1 Jacob L. Anawalt <janawalt@geckosoftware.com>

> On 2008-12-01 06:01, Peter Doornbosch wrote:
>
>> Got it now. As  the application is defining _ MBCS, LPCTSTR is actually a
>> pointer to a char,
>>
>
> Long Pointer to a Const Tchar STRing.


Yep, and when _MBCS is defined, TCHAR is char.


>
>
>  which i must convert to unicode (using
>> MultiByteToWideChar), as the LogString constructor is expecting unicode,
>> is
>> that right?
>>
>>
> I don't know if that is the cause of your error, it would cause size
> differences when using functions that assume sizeof(character) (eg TCHAR) ==
> sizeof(char) (byte) and confuse character counts with byte sizes.


No no, this is not the error case. I was looking for a way to convert
CString to LogString. I now use MultiByteToWideChar to convert a LPCSTR to a
unicode string. This works fine, in all cases (statically or dynamically
linked).


> Seems strange that it would work or not depending on your use of MFC
> (static or not). That sounds more like a new/free or other memory tracking
> mixup.


Exactly, that was what i thought; that was why i dropped the issue on this
list in the first place.
But this issue (application crashes with assertion error when statically
linked) concerns use of the LOG4CXX_DECODE_CHAR macro, which i first used to
convert CString into LogString. But as Curt discouraged the use of this
macro, i looked for an alternative and ended up with this
MultiByteToWideChar conversion, which seems to work ok. Sorry for the
confusion.

Note that the original issue (macro causes failed assertion) still persists,
but it's not bothering me anymore.

Thanks.

Regards,
Peter

>
>
> --
> Jacob Anawalt
> Gecko Software, Inc.
> janawalt@geckosoftware.com
> 435-752-8026
>

Mime
View raw message