0

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

3
Contributors
6
Replies
8
Views
9 Years
Discussion Span
Last Post by Ancient Dragon
0

Hi,

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

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.

0

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


Thanks,
pad510

1

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

Votes + Comments
Thanks for the correction.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.