By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,039 Members | 1,831 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,039 IT Pros & Developers. It's quick & easy.

error linking c++ and asm

P: 2
i want to call a procedure from asm but when i want to link my program it show some error
like de _cout procedure doesn't exist and _printf and others =/.....
i think that maybe the obj of my program in c++ its not right but how i make it!! i use borland c++ 4.5
Nov 30 '10 #1

✓ answered by Raj K

- From the assembly you need to call mangled name instead of the name that appears in C++ code.
- Different compilers use different strategies for name mangling.
- Here is name mangling described. This article uses g++ as compiler. You need to explore your compiler behavior for the same.
Here is the link -
http://avabodh.com/cxxin/namemangling.html

- If the link error is due to your C++ code, then look for extern keyword, it might help

Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
C++ uses name mangling, that is the function name os not the actual name you give it, which is required to support function overloading.

If you want to call an assembler function or call a function from an assembly routine then you are better off declaring it as a C function. C does not use name mangling (and does not support function overloading) and so it is easier to translate the name correctly for the assembly code.

Normally the name in assembly is the same as the name in C with a prepended _
Nov 30 '10 #2

P: 9
- From the assembly you need to call mangled name instead of the name that appears in C++ code.
- Different compilers use different strategies for name mangling.
- Here is name mangling described. This article uses g++ as compiler. You need to explore your compiler behavior for the same.
Here is the link -
http://avabodh.com/cxxin/namemangling.html

- If the link error is due to your C++ code, then look for extern keyword, it might help
Dec 8 '10 #3

P: 2
thanks, but i did'nt work, it was the same that i had done ='( i'll try with the g++ compiler like you said
Dec 15 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.