943,712 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 736
  • C++ RSS
Mar 28th, 2008
0

Unresolved external Symbol

Expand Post »
Hi,

When I am trying to return a QString from a method I am getting linker error.
My code is like:

extern "C"{
_declspec QString _stdcall function1(char* name);

}

I am using MSVC 6.0 compiler.
Could any body help me?

(NOte: If I remove _stdcall its working fine)

Thanks in Advance,
pad510
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pad510 is offline Offline
3 posts
since Mar 2008
Mar 28th, 2008
0

Re: Unresolved external Symbol

>>(NOte: If I remove _stdcall its working fine)
Then what's the problem? Leave _stdcall out then.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Mar 28th, 2008
0

Re: Unresolved external Symbol

Hi,

I am wondering what is the problem with _stdcall,since its working for all other types(pre defined and user defined) except QString
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pad510 is offline Offline
3 posts
since Mar 2008
Mar 28th, 2008
0

Re: Unresolved external Symbol

_stdcall and _cdecl are identical and are the default for C and C++ functions. Therefore is never a reason to use _stdcall or _cdecl in C and C++ programs. Using Microsoft compilers that is. What compiler are you using?

I don't know why its not working for you. Are you sure you have the correct prototype? Do you have the source code for the function so that you can verify -- but you probably already did that.
Last edited by Ancient Dragon; Mar 28th, 2008 at 6:47 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005
Mar 28th, 2008
0

Re: Unresolved external Symbol

Hi,
Thanks for reply.
I am using MSVC 6.0.
Me to not sure about the problem


Thanks,
pad510
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pad510 is offline Offline
3 posts
since Mar 2008
Mar 28th, 2008
1

Re: Unresolved external Symbol

_cdecl and _stdcall has some difference, I think you are calling the function from the library written using different calling convention than the one you are using. Its basically a name decoration issue, not resolved by linkers.

In VC++ 6.0 _cdecl is the default calling convention.

_cdecl In this type convention the caller is responsible for cleaning up the stack.
_stdcall In this type of convention the callee is responsible for cleaning up the stack.

search calling conventions.
Reputation Points: 113
Solved Threads: 20
Junior Poster
Laiq Ahmed is offline Offline
147 posts
since Jun 2006
Mar 28th, 2008
0

Re: Unresolved external Symbol

Click to Expand / Collapse  Quote originally posted by Laiq Ahmed ...
_cdecl and _stdcall has some difference,.
Yes you are right. .
Last edited by Ancient Dragon; Mar 28th, 2008 at 10:33 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,950 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: how to save an exe file from server machine to client machine
Next Thread in C++ Forum Timeline: help with looping





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC