trouble linking an asm file w/ vC++
Are you looking to use MASM to write those time critical functions but just can't get it into MSVC++????
well so was I... and i found my answer in the microsoft Knowledge base... (microsoft actually helping us??? hmmm..)
anyway.. goto article Q106399 (or goto the address i give here)
http://support.microsoft.com/support/kb/articles/Q106/3/99.asp?LNG=ENG&SA=PER&FR=0
ps. (i just edited over my original question with this answer because i worded it bad anyway)
good luck,
RanXact
Edited by - ranxact on 2/15/00 10:17:52 PM
RanXact@yahoo.com
You're missing the braces. VC++ requires braces wrapping the function header like so:
extern "C" {
// function header
}
In Borland you can declare without the braces, but in VC++ I'm pretty certain they're required. Also, the docs state calls to MASM generated functions should be declared with __stdcall like this:
extern "C" {
return_type __stdcall FunctionName ();
}
Where return_type is, of course, int, void, float, etc...
I've actually never used __stdcall when calling external assembly routines and I've had no problems. The books I've read do not use it. Now I will after reading the docs.
Another thing, extern "C" is NOT legal in the C language. It can only be used from within C++. If you are declaring functions for C source files only then you do not need the extern "C" syntax.If you have functions to be used with C AND C++ source files, this is how you should declare them:
#ifdef __cplusplus
extern "C" {
#endif
// function headers go here
#ifdef __cplusplus
}
#endif
Edited by - Aldacron on 2/14/00 7:10:39 PM
extern "C" {
// function header
}
In Borland you can declare without the braces, but in VC++ I'm pretty certain they're required. Also, the docs state calls to MASM generated functions should be declared with __stdcall like this:
extern "C" {
return_type __stdcall FunctionName ();
}
Where return_type is, of course, int, void, float, etc...
I've actually never used __stdcall when calling external assembly routines and I've had no problems. The books I've read do not use it. Now I will after reading the docs.
Another thing, extern "C" is NOT legal in the C language. It can only be used from within C++. If you are declaring functions for C source files only then you do not need the extern "C" syntax.If you have functions to be used with C AND C++ source files, this is how you should declare them:
#ifdef __cplusplus
extern "C" {
#endif
// function headers go here
#ifdef __cplusplus
}
#endif
Edited by - Aldacron on 2/14/00 7:10:39 PM
--- Official D Blog | Learning D | The One With D | D Bits
Thank YOu for the info, but that was only one of my problems. (i was using a c program not c++ to test my funcs.. DOH!) my main problem is that i don''t know how to get VC++ to use the funcitons.. as in the linker cannot find them, or it searches for them in Kernal32.dll....
this is the error when i debug it
Loaded ''C:\WINDOWS\SYSTEM\KERNEL32.DLL'', no matching symbolic information found.
The thread 0xFFF84B83 has exited with code 259 (0x103).
The program ''c:\MASM32\TEMP\Tester\Debug\Tester.exe'' has exited with code 259 (0x103).
but why is it looking there and how do i tell it to look where it should? and for that matter, what file should i give it? really i know it is something stupid... but again help would be appreciated
Thank you,
RanXacT
this is the error when i debug it
Loaded ''C:\WINDOWS\SYSTEM\KERNEL32.DLL'', no matching symbolic information found.
The thread 0xFFF84B83 has exited with code 259 (0x103).
The program ''c:\MASM32\TEMP\Tester\Debug\Tester.exe'' has exited with code 259 (0x103).
but why is it looking there and how do i tell it to look where it should? and for that matter, what file should i give it? really i know it is something stupid... but again help would be appreciated
Thank you,
RanXacT
RanXact@yahoo.com
I''m pretty sure you should add the compiled asm file (the obj file) to the project so it gets linked in with the project''s compiled C/C++ source files... If that''s what you''re asking.
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
I''ve Found what i was looking for!!!!
all these answers and more have been answered in the microsoft Knowledge Base
![](smile.gif)
well, the addy is long, but here it is
http://support.microsoft.com/support/kb/articles/Q106/3/99.asp?LNG=ENG&SA=PER&FR=0
i''d cut and paste it, but it is kinda long.
thank you all for your help...
and i hope that this may be of some help to the other poor clueless souls out there like me ...
![](smile.gif)
RanXacT
RanXact@yahoo.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement