C & Asm

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Ahmet

C & Asm

Post by Ahmet »

I have C and asm files which I want to link them. I compiled C files with tcc and asm files with tasm. But I wonder how the linker(tlink) understands the entry point of code.

Here is my makefile:

pmode.exe: pmodeasm.obj pmodec.obj
   tlink /c /x /3 c:\tc\lib\c0s pmodeasm pmodec, pmode,, c:\tc\lib\cs
pmodeasm.obj: pmodeasm.asm
   tasm /m2 /mx /zi /o pmodeasm.asm
pmodec.obj: pmode.h pmodec.c
   tcc /c pmodec.c

And tlink gives this error:
Error: Undefined symbol _main in module c0.ASM

But my main code is in asm part and I use C file to call some function from it. how can I tell the linker that the entry point of code is in Asm file?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:C & Asm

Post by Pype.Clicker »

name your entry point _main :)

however, if you have a ASM entry point, i'm not sure you need c:\tc\lib\c0s to be linked. that runtime library is likely to have its own entry point which calls _main, and you might have trouble with it as it could perform operations you don't want to be performed ...
Post Reply