July 09, 2002
I'm having problems linking with external assembly modules. It looks as if external assembly routines are never called despite being called from C. I'm using the latest compiler 8.29.5 and Borland's tasm v.3.2.

Here is a minimal 32-bit program that illustrates the problem.

C-code:-(test.c)---------------------------------------------------------------------------------------

#include <stdio.h>
int main (void)
{
  extern int val;
  extern void foo (int);

  val = 10;
  printf ("val = %d\n", val);

  foo (11);
  printf ("val = %d\n", val);
  return (0);
}

asm-code---(test1.asm)--------------------------------------------------------------------------
.386
.MODEL FLAT,C
.DATA
      public val
      val dd 0

.CODE
public foo
foo:
      mov eax, [esp+4]
      mov val, eax
      ret
end

bat-file ---(test.bat)-----------------------------------------------------------------------------------
tasm /mx test1.asm
dmc -g -mx test.c test1.obj x32.lib

-------------------------

the printout is:
  val = 10
  val = 10

But I would expect
  val = 10
  val = 11

What is the problem?

Gisle V.