[fpc-pascal] Dynamic loading to static?
Sven Barth
pascaldragon at googlemail.com
Sat Oct 26 10:26:34 CEST 2019
Am 25.10.2019 um 20:49 schrieb Ryan Joseph:
>
>> On Oct 25, 2019, at 12:02 PM, Michael Van Canneyt <michael at freepascal.org> wrote:
>>
>> You need to manually change them.
>>
>> if you look in the packages, you'll see that many library import units exist in 2
>> flavours. One static, one dynamic.
> That’s what I was afraid of.
>
> btw, I why does ObjFPC mode not allow this but Delphi mode does? GetProcAddress returns a pointer and I get a type error which can’t be solved because the type of Py_Initialize is anonymous, i.e. there is no formal declaration. Is there a way to cast around this in ObjFPC mode? It would be lots of extra work to add the extra types in because the original code was Delphi.
>
> var
> Py_Initialize: procedure; cdecl;
> begin
> Py_Initialize := GetProcAddress(handle, 'Py_Initialize');
The FPC modes are simply more stricter, more like the original Pascal in
that case. After all a Pointer is not simply a procedure variable.
For your case you can solve it like this:
=== code begin ===
CodePointer(Py_Initialize) := GetProcAddress(handle, 'Py_Initialize');
=== code end ===
Regards,
Sven
More information about the fpc-pascal
mailing list