hi.
i try to use this units from arduino example "HardTimerAsEncoder".
was complied using gcc c compiler (arduino ide)
program project_ext_c_lib;
//{$L HardwareTimer.o}
uses cortexm3;
{$O-}
Procedure HardwareTimer(ID: byte); cdecl; external;// name 'HardwareTimer';
{$L HardwareTimer.o}
Procedure pause; cdecl; external;// name 'pause';
{$L HardwareTimer.o}
Procedure attachInterrupt(pin: byte; handler: byte; mode: byte); cdecl; external;
{$L ext_interrupts.o}
begin
HardwareTimer(2);
pause;
attachInterrupt(0,0,0); //not real params values, just to test compiler/linker
end.
and the result was.....
Messages window
***************************
Compile Project, OS: embedded, CPU: arm, Target: project_ext_c_lib: Exit code 1, Errors: 1
C:\Users\user\Documents\lib\arm-embedded\project_ext_c_lib.o: In function `PASCALMAIN':
project_ext_c_lib.lpr:(.text.n_main+0x14): undefined reference to `HardwareTimer'
project_ext_c_lib.lpr:(.text.n_main+0x18): undefined reference to `pause'
project_ext_c_lib.lpr:(.text.n_main+0x28): undefined reference to `attachInterrupt'
project_ext_c_lib.lpr(25,0) Error: Error while linking
***************************
what i do wrong?
HardwareTimer.o and ext_interrupts.o and its parents .h and .cpp files are in the same directory of project
lazarus 2.1.0 fpc 3.3.1 win 10
thanks