I've been thwarted in every attempt to use C functions defined using masm 6.1, and I would really appreciate any help in doing so. I'm using:
MSVC 1.0 pure 16 bit dos app (med mem model)
MASM 6.1 medium mem model
I could use help with a few functions - return current cursor position, set cursor position, and clear the screen. I can create a library that works using C and inline asm, but I want to expand the library and make it portable.
C function prototypes with inline asm
extern void clearScreen(void);
extern short getCursor(void); // only interested in current y pos
extern void setCursor(unsigned char, unsigned char); or
extern void setCursor(short, short);
I've tried stuff like
.model medium
.code
PUBLIC _clearScreen
_clearScreen proc
blah
_clearScreen endp
end
extern "C" {void clearScreen(void);} // causes a string error.. go figure
extern void _cdecl clearScreen(void); // compiles into obj ok..
int main(void)
{
clearScreen();
return 0;
}
At link time though it always results in unresolved external _clearScreen(); despite me inclucing in the asm library file.
If I use the inline asm library that I created in C, then all is ok. Anyone have any ideas?
TIA
Comments
I've never used MASM (I use TASM) instead, but I think you have to activate the "Case Sensitivity" command line switch, else your function name will be CLEARSCREEN (you can test it immediately in your C program to see if this is the cause).
________________
[size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
You know, come to think of it I believe it was all caps. Thanks for the tip!! I'll try that.