[fpc-pascal] Teaching Kids Using Free Pascal
Anthony Walter
sysrpl at gmail.com
Sat Aug 27 12:47:26 CEST 2022
Thomas,
Chimpmunk2D is written in C and I compiled it on Windows using three
different compilers, each in an attempt to resolve the problem. I used
mingw64 gcc with Linux cross compile, Windows Cygwin, and Windows Msys2.
All fail for various reasons.
Regarding your missing __imp___acrt_iob_func, you can resolve individual
missing dependencies by providing them yourself using the 'alias' feature
of Free Pascal. This should at least resolve the dependency:
function acrt_iob_func: Pointer; cdecl; [ public, alias:
'__imp___acrt_iob_func'];
begin
Result := nil;
end;
According to this stack overflow, the actual implementation should return a
pointer to an array of three HFILE items somewhat like FILE _iob[] =
{*stdin, *stdout, *stderr}; You can see if it can compile / link by using
my implementation above. In the situations where I was able to widdle down
the dependencis to to one or tow, this trick worked, but unfortunately
after that I would get an internal linker error. Even in cases where I
resolved all dependencies without the trick I still eventually end up with
an internal linker error.
https://stackoverflow.com/questions/30412951/unresolved-external-symbol-imp-fprintf-and-imp-iob-func-sdl2
Finally, I also wrote a utility to search for missing dependencies on
Windows.
https://cache.getlazarus.org/images/desktop/raylib-static.png
Henery Vermaak offered a similar solution for use at the command line.
(begin quote)
Note for anyone with msys2, you can make a file containing all defined
external symbols like this (using atexit as an example):
find /mingw64/lib -name "*.a" -exec nm -pogC --defined-only '{}' \; 2>
/dev/null > symbs.txt
Then search it with grep:
grep -w atexit symbs.txt
Resulting in:
C:/msys64/mingw64/lib/libmsvcr120.a:libmsvcr120_defs01591.o:0000000000000000
T atexit
C:/msys64/mingw64/lib/libmsvcr120_app.a:libmsvcr120_app_defs01268.o:0000000000000000T
atexit
C:/msys64/mingw64/lib/libmsvcr120d.a:libmsvcr120d_defs01654.o:0000000000000000
T atexit
(end quote)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20220827/d8eac41b/attachment.htm>
More information about the fpc-pascal
mailing list