954,148 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Unresolved external Symbol

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

pad510
Newbie Poster
3 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

>>(NOte: If I remove _stdcall its working fine)
Then what's the problem? Leave _stdcall out then.

Ancient Dragon
Retired & Loving It
Team Colleague
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

Hi,

I am wondering what is the problem with _stdcall,since its working for all other types(pre defined and user defined) except QString

pad510
Newbie Poster
3 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

_ 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.

Ancient Dragon
Retired & Loving It
Team Colleague
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

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


Thanks,
pad510

pad510
Newbie Poster
3 posts since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

_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.

Laiq Ahmed
Junior Poster
148 posts since Jun 2006
Reputation Points: 113
Solved Threads: 20
 
_cdecl and _stdcall has some difference,.

Yes you are right. .

Ancient Dragon
Retired & Loving It
Team Colleague
30,042 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,341
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You