[fpc-pascal] Dynamic loading to static?

Ryan Joseph genericptr at gmail.com
Fri Oct 25 16:56:55 CEST 2019


Maybe a stupid question but I thought I’d asked before I potentially waste a bunch of time. I have code to dynamically load functions using Dynlibs.LoadLibrary, for example:

type
  _Py_Initialize = procedure; cdecl;
  _PyImport_ImportModule = function(module: pchar): PPyObject; cdecl;

var
  […]
  Py_Initialize := _Py_Initialize(GetProcAddress(handle, 'Py_Initialize'));

The problem is I would like to change this to static linking now but I only have function pointers instead of declarations. Is there a way I can get the compiler to statically link these function pointers or do I need to manually change them all by hand to be things like:

	function  PyImport_ImportModule(module: pchar): PPyObject; cdecl;

Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list