Pascal+asm, не подключается модуль asm - Free Pascal
Формулировка задачи:
Не получается подключить модуль ассмблера ( находится в каталоге с .pas)).
Для примера взял элементарный код на паскале:
fpc ругается, что не может найти файл:
1 {$L timer.o} 2 Procedure init_timer; cdecl; external; 3 Function get_timer: longint; cdecl; external; 4 {$LinkLib c} 5 6 var 7 i,k,s:longint; 8 begin 9 s:=1; 10 init_timer; 11 for i:=1 to 100 do 12 s:=s*(2+i); 13 k:=get_timer; 14 writeln(k/18:2:5); 15 end.
Free Pascal Compiler version 2.6.0 [2012/05/14] for x86_64 Copyright (c) 1993-2011 by Florian Klaempfl and others Target OS: Linux for x86-64 Compiling asm.pas Linking asm /usr/bin/ld: warning: link.res contains output sections; did you forget -T? /usr/bin/ld: skipping incompatible timer.o when searching for timer.o /usr/bin/ld: skipping incompatible ./timer.o when searching for timer.o /usr/bin/ld: cannot find timer.o asm.pas(15,1) Error: Error while linking asm.pas(15,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Error: /usr/bin/ppcx64 returned an error exitcode (normal if you did not specify a source file to be compiled)
Решение задачи: «Pascal+asm, не подключается модуль asm»
textual
Листинг программы
$ file timer.o timer.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped