12.3 Using a library in a pascal program (code fix)
Original Reporter info from Mantis: trev @trevoz
-
Reporter name: Trevor Roydhouse
Original Reporter info from Mantis: trev @trevoz
- Reporter name: Trevor Roydhouse
Description:
https://www.freepascal.org/docs-html/current/prog/progse56.html
Listing: progex/psubs.pp is missing {$linklib libsubs} at the start without which compilation fails with:
Undefined symbols for architecture x86_64:
"_SubStr", referenced from:
_PASCALMAIN in dynlibtest.o
ld: symbol(s) not found for architecture x86_64
An error occurred while linking ... etc.
Also, I query the inclusion of 'subs' in the line:
function SubStr(const CString: PChar; FromPos, ToPos: longint): PChar; cdecl; external ’subs’;
Including it or omitting it makes no difference in my tests, but maybe I'm missing the reason for its inclusion.
Steps to reproduce:
Try compiling the code "as is" with the previous page library.