[fpc-pascal]Linking with external ASM files (compiled by NASM)

Sebastian Schuberth s.schuberth at gmx.net
Wed Oct 4 15:46:35 CEST 2000


Hello guys!

I'm tring to link an external ASM program into a Free Pascal unit:

--8<--(test.asm)--

section .text
bits 32

global test_

test_:
xor eax,eax
ret
  
--8<--(test.asm)--

To compile the ASM file I use: "nasm -f coff -o test_asm.o test.asm"

--8<--(test.pas)--

Unit Test;

Interface

Procedure a;

Implementation

{$L TEST_ASM.O}
Procedure test_; External;

Procedure a; Assembler;
Asm
  { do some stuff }
  call test_
  { do some stuff }
End;

End.

--8<--(test.pas)--

And a main program:

--8<--(main.pas)--

Program Main;

Uses
  Test;
  
Begin
  a;
End.

--8<--(main.pas)--

When executing "ppc386 main.pas" the linker always complains that
"TEST_" would be
an undefined reference. Since "TEST_" is written uppercase I already
tried to define
the test_ procedure within the ASM file uppercase, too, but it didn't
help. What am
I doing wrong?

-- 

Sebastian Schuberth




More information about the fpc-pascal mailing list