On 2023-07-12 12:27, Thomas Kurz via fpc-pascal wrote:
I have to extend code from QuickBasic and am using the "msdos" target
from FPC 3.2 for that purpose. The resulting exe file is linked with
Microsoft Linker for DOS version 5.10. It links *.a files created both
from QuickBasic and FPC. The memory model is i8086-small.

Basically, it works well.

I have to use file functions now (Assign, Reset, Close) and as soon as
I start using any of these, linking fails with the following
unresolved dependencies:

Z:\SYSTEM.LIB(prt0s.asm) : error L2029: '__stklen' : unresolved external Z:\SYSTEM.LIB(prt0s.asm) : error L2029: 'PASCALMAIN' : unresolved external
Z:\SYSTEM.LIB(prt0s.asm) : error L2029: '___heap' : unresolved external
Z:\SYSTEM.LIB(system0s896.o) : error L2029: 'INITFINAL' : unresolved external Z:\SYSTEM.LIB(prt0s.asm) : error L2029: '___stacktop' : unresolved external
Z:\SYSTEM.LIB(prt0s.asm) : error L2029:
'__fpc_stackplusmaxheap_in_para' : unresolved external

Which *.a files and *.o files did you include for linking and how did you compile the FPC part (which parameters)?


 .
 .
Note that I'm *not* compiling and linking the full program with FPC,
I'm only developing parts of it. The main part comes from QuickBasic.
But as FPC is able to build fully working MS-DOS executables in which
(I assume) it needs the criticized external dependencies as well, they
should exist somewhere, shouldn't they? But what do I need to link
against for them to be included?

They're part of the main executable (i.e. FPC compiled program). As an example, PASCALMAIN is the entry point of the FPC program. The trouble is that you don't create a FPC program here. However, you must still ensure initialization (and finalization) of the FPC RTL. On other platforms/targets, you'd do this by creating a DLL/shared library, but that is not supported for the msdos target. You might try creating a simple FPC program using your units, compiling with -s and checking the list of *.o and *.a files included in the generated linker response file.

Tomas
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to