This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Bug with Edge when using ATL


Bug with Edge when using ATL

Postby gilad_no » Mar 13, 2007 @ 5:28pm

When I'm using Edge under ATL project, I get linking errors:

(When wchar_t is defined as built in type)
Main.obj : error LNK2019: unresolved external symbol "public: static long __cdecl ClassEStd::StrLen(wchar_t const *,unsigned long)" (?StrLen@ClassEStd@@SAJPB_WK@Z) referenced in function "void __cdecl GetPath(wchar_t *)" (?GetPath@@YAXPA_W@Z)
Main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl ClassEStd::StrCpyW(char *,wchar_t const *,long)" (?StrCpyW@ClassEStd@@SAXPADPB_WJ@Z) referenced in function _wWinMain@16
Main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl ClassEStd::StrCpyW(wchar_t *,char const *,long)" (?StrCpyW@ClassEStd@@SAXPA_WPBDJ@Z) referenced in function _wWinMain@16

(Without wchar_t)
Main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl ClassEStd::StrCpyW(char *,unsigned short const *,long)" (?StrCpyW@ClassEStd@@SAXPADPBGJ@Z) referenced in function _wWinMain@16
Main.obj : error LNK2019: unresolved external symbol "public: static void __cdecl ClassEStd::StrCpyW(unsigned short *,char const *,long)" (?StrCpyW@ClassEStd@@SAXPAGPBDJ@Z) referenced in function _wWinMain@16
gilad_no
pm Member
 
Posts: 22
Joined: Feb 13, 2007 @ 5:50pm
Location: Montreal


I think I found a solution

Postby gilad_no » Mar 13, 2007 @ 6:24pm

ATL overrides StrCpy with StrCpyW. Before including edgemain.h, you need to under StrCpy:

#undef StrCpy
gilad_no
pm Member
 
Posts: 22
Joined: Feb 13, 2007 @ 5:50pm
Location: Montreal


Postby edge » Mar 14, 2007 @ 12:28pm

Hi Gilad,

Thanks for the fix. We've updated the Edge header files to undefine this symbol.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


It's not only StrCpy

Postby gilad_no » Mar 14, 2007 @ 5:39pm

It's related to StrCat/StrTrim as well.

Undef those symbols is just a workaround, since it would break the usage of the real StrCpy/StrCat/StrTrim functions in the application.

I think that you should put those undef in edgemain only when the user defines a specific flag.

#ifdef ATL_WORKAROUND
#undef StrCpy
#undef StrCat
#undef StrTrim
#endif

And to add an entry to the FAQ, for users to add ATL_WORKAROUND when they have the same bug.

The ideal solution would be to modify your functions ClassEStd::StrCpy to something else (Since it conflicts with atlsafe AND with shlwapi definitions).

- Gilad
gilad_no
pm Member
 
Posts: 22
Joined: Feb 13, 2007 @ 5:50pm
Location: Montreal


Postby edge » Mar 15, 2007 @ 4:00pm

Hi Gilad,

Thanks for your suggestions.

Unfortunately, we can't change the name of these functions as this would ruin backwards compatibility.

I think adding a check for ATL_WORKAROUND wouldn't work, because in the case it's not defined, an error occurs (so it should always be defined). It would only take additional effort from the developer.

Because these #undefs are used in the edge.h header file, they only take effect when this header file is included (the native ATL functions can be used before including this file).
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron