Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2023-07

msdos: unresolved external

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Thomas Kurz

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

To me, it looks as if these were very basic code for memory management. I found (e.g.) "__fpc_stackplusmaxheap_in_para" in prt0comn.asm in which is declared "extern". But I'm unable to see which external object is responsible for it.

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?

Thanks for helping,
Thomas

Tomas Hajny
to Thomas Kurz
Thomas Kurz wrote 22 lines
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)?

.
.

Show quoted text 6 lines
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