• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 393
  • Last Modified:

Link Assemly function with Turbo C in DOS

Can any one tell me how to link an assembly function with Turbo C 2.0 in DOS?
i write something like thissegment dseg
Assembly file: hello.asm

msg:    db      'Hello, Dear World$'

segment sseg stack
       resb 0x40

segment cseg
       mov     ax, dseg
       mov     ds, ax
       mov     dx, msg
       mov     ah, 0x09
       int     0x21
       mov     ah, 0x4C

C file: try.c
void hi(void)
void main()

i compiled try.c into try.obj in Turbo C2.0 IDE
then i use command line:
nasmw -fobj hello.asm
tlink lib\c0s try hello,try,,lib\cs

the result is
Undefined symbol "_HI" in module try.c

How should i correct this plz?
1 Solution
You need to declare _hi as Public function.
Try to add to ASM file:
_hi proc near
   Hi Code...
_hi endp
public _hi

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now