Article View: borland.public.cppbuilder.internet.socket
Article #5572Re: [Linker Error] Unresolved external '__fastcall Idmessagecollection::TIdMessageCollection::GetMessageA(int)' referenced from ...
From: Remy Lebeau (TeamB)
Date: Tue, 13 Jul 2004 18:35
Date: Tue, 13 Jul 2004 18:35
64 lines
3236 bytes
3236 bytes
"Andreas Berglund" <darkante@icqmail.com> wrote in message
news:40f3d35a@newsgroups.borland.com...
> I get this error with this line of code:
Please don't put the error messages in the SUBJECT of your messages. Put
them into the BODY instead. Not everyone reads subjects, thus your messages
could go unseen.
> I can access some parts, but not others. As soon as
> i go as deep as MessageList i get this error.
Looking at the error message, it is a classic Win32 API problem that plagues
many aspects of the VCL under C++. If you look closer, you will see that
the error is complaining about a missing GetMessageA() method. However, the
actual method is named GetMessage() instead, thus the linker error.
Microsoft uses #define macros in its header files to define certain
functions that have ANSI/UNICODE parameters. GetMessage() is such a Win32
API function:
WINUSERAPI
BOOL
WINAPI
GetMessageA(
OUT LPMSG lpMsg,
IN HWND hWnd,
IN UINT wMsgFilterMin,
IN UINT wMsgFilterMax);
WINUSERAPI
BOOL
WINAPI
GetMessageW(
OUT LPMSG lpMsg,
IN HWND hWnd,
IN UINT wMsgFilterMin,
IN UINT wMsgFilterMax);
#ifdef UNICODE
#define GetMessage GetMessageW
#else
#define GetMessage GetMessageA
#endif // !UNICODE
Since #define macros are global in scope, they can effect everything else
that happens to use the same names that Microsoft also uses. In this case,
everywhere that has something named "GetMessage" declared, the #define
statement is altering to be named "GetMessageA" instead. Thus Indy's
declaration of the getter method for the Messages[] property in the
TIdMessageCollection class is being changed at compile-time.
> I've searched the net and newsgroups, but didnt find much about linker
> errors with indy.
This is not a problem that is specific to Indy. Microsoft's macros can
effect any VCL component used under C++ which is not designed with such
macros in mind. Even some of Borland's native components are effected by
this problem. Blame Microsoft for not designing its own header files
better.
Gambit
Technical Details
Message-ID:
<40f42b61$7@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40f3d35a@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,d48cb99527f2eb72 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <gambit47.no.spam@no.spam.yahoo.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <40f3d35a@newsgroups.borland.com> Subject: Re: [Linker Error] Unresolved external '__fastcall Idmessagecollection::TIdMessageCollection::GetMessageA(int)' referenced from C:\PROGRAM\BORLAND\CBUILDER6\PROJECTS\IMAP TESTER\UNIT1.OBJ Date: Tue, 13 Jul 2004 11:35:55 -0700 Lines: 66 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <40f42b61$7@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1089743713 68.69.17.41 (13 Jul 2004 11:35:13 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail