Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tasm + bc

Status
Not open for further replies.

ionutdinulescu

Programmer
Jun 11, 2002
59
0
0
GB
I have the following asm routine compiled with tasm:

PUBLIC _restore_flags
_restore_flags PROC
PUSH BP
bla, bla, bla :)
RET
_restore_flags ENDP

I want to call the above routine from bc++. In BC I declare the function:
extern void restore_flags(short savedFlags);
The problem is that the linker does not find the definition of the routine. I included the obj and cpp in a project but it still doesn't work.
I also tried by removing the paramter, but same result.
I know that tasm adds or removes a trailing _ to the routine names, but i'm not not sure how this exactly works. Does anyone have a working example ?

Thanks.
 
I've found a "working" example that doesn't work on my computer (but the sender is convinced that's working)
//--testc.cpp
#include <stdio.h>
extern int rez(int,int);
void main(){
int x,y;
int v=rez(3,5);
printf("%d", v);
}
//--testa.asm
.model small
.stack 100
.code
public _rez
_rez proc near
push bp
mov bp,sp
mov ax,[bp+4]
add ax,[bp+6]
pop bp
ret
_rez endp
end

I use the following commands to compile&link :
d:\borlandc\bin\bcc -ms -c -Id:\borlandc\include testc.cpp
d:\borlandc\bin\tasm /ml testa.asm
d:\borlandc\bin\tlink d:\borlandc\lib\c0s testc testa, testc,,d:\borlandc\lib\cs

The linker tells me :
Undefined symbol rez(int,int) in module TEST.CPP

I use bcc ver3.1, asm ver3.1, tlink ver 5.1

Does anyone know what is happening ???
It's URGENT !!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top