Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2005

Tip: Looking for answers? Try searching our database.

stupid name mangling problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bruno van Dooren - 25 Mar 2005 18:41 GMT
Hi all,

i have developed a class that has a member called 'PostMessage'

if i only reference this member from within the class context, there is no
problem, but if i trie to execute it as a method, i get the error

error LNK2019: unresolved external symbol "public: void __thiscall
MessageQ::PostMessageA(struct t_Message *)"
(?PostMessageA@MessageQ@@QAEXPAUt_Message@@@Z) referenced in function
"public: void __thiscall Dispatcher::SendMessageA(struct t_Message *)"
(?SendMessageA@Dispatcher@@QAEXPAUt_Message@@@Z)

The offending code is:
msgQ->PostMessage(Message);

where msgQ is an instance of my own class MessageQ, and the method exists
with the correct prototype.

can anybody please tell me how to solve this problem?

thanks,

Bruno.
Fredrik Wahlgren - 25 Mar 2005 18:44 GMT
> Hi all,
>
[quoted text clipped - 20 lines]
>
> Bruno.

There is an API function with the same name. What happens if you rename it?

/Fredrik
Bruno van Dooren - 25 Mar 2005 22:12 GMT
>> Hi all,
>>
[quoted text clipped - 26 lines]
>
> /Fredrik

thanks for your reply.
my functions linked fine if i renamed them.
as Carl said in his answer, those functions are defined as macros. as a
result, my function names got replaced by the windows function names.

Bruno.
Carl Daniel [VC++ MVP] - 25 Mar 2005 19:10 GMT
> Hi all,
>
[quoted text clipped - 3 lines]
> is no problem, but if i trie to execute it as a method, i get the
> error

#undef PostMessage - it's a macro defined by windows.h (either PostMessageA
or PostMessageW depending on _UNICODE).

-cd
Bruno van Dooren - 25 Mar 2005 22:10 GMT
Ok that makes sense.
that also explains why it worked within the class definition: i didn't
include windows.h there.

thanks all.

Bruno.

>> Hi all,
>>
[quoted text clipped - 8 lines]
>
> -cd

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.