Am 25.10.2019 um 20:49 schrieb Ryan Joseph:

On Oct 25, 2019, at 12:02 PM, Michael Van Canneyt <mich...@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
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to