use LoadLibrary & GetProcAddress question! lazarus / 1-Linux ---------------------------------------------------------------------- seewind · 2009-06-03 15:25 the project PyMinMod.lpi on attach file, is use fpc make python extend module. there are two methodes to declare python API, like this: 1.function PyInt_FromLong(along : LongInt) : PyObject; cdecl; external PythonLib; 2.var PyInt_FromLong1: function (along : LongInt) : PyObject; cdecl; pyhl := LoadLibrary({$ifdef LINUX} '/usr/lib/' + {$endif}PythonLib); @PyInt_FromLong1 := GetProcAddress(pyhl, 'PyInt_FromLong'); when use PyInt_FromLong1, this module will crack: see@debian:~/dev/freepascal/demo/simple$ python test.py An unhandled exception occurred at $B7BB93EE : EAccessViolation : Access violation   $B7BB93EE I have test this code at debian(fpc2.2.4, python2.5) and ubuntu(fpc2.2.2, python2.6) other question: 1.on ubuntu, Py_InitModule4 is doesn't work。 @Py_InitModule4 := GetProcAddress(pyhl, 'Py_InitModule4'); 2.below two line code is same? @PyInt_FromLong1 := GetProcAddress(pyhl, 'PyInt_FromLong'); PyInt_FromLong1 := GetProcAddress(pyhl, 'PyInt_FromLong'); please help, thank you! ---------------------------------------------------------------------- icebit · 2009-06-03 17:14 1. Try: Pointer(Py_InitModule4) := GetProcAddress(pyhl,'Py_InitModule4'); 2. No. ---------------------------------------------------------------------- seewind · 2009-06-04 03:19 Pointer(Py_InitModule4) := GetProcAddress(pyhl,'Py_InitModule4'); the code error: PyAPI.pas(95,3) Error: Wrong number of parameters specified for call to "" have two points to add: 1.the project PyMinMod.lpi run on windows system is fine. 2.other functions like:   DLL_PyArg_ParseTuple := GetProcAddress(pyhl, 'PyArg_ParseTuple');   PyCallable_Check := GetProcAddress(pyhl, 'PyCallable_Check');   PyBool_FromLong := GetProcAddress(pyhl, 'PyBool_FromLong'); have not the issue. ---------------------------------------------------------------------- Leledumbo · 2009-06-04 04:43 In what mode are you compiling? Delphi or ObjFPC? ---------------------------------------------------------------------- seewind · 2009-06-04 07:15 {$MODE Delphi} This project's code is modify from http://wiki.lazarus.freepascal.org/Developing_Python_Modules_with_Pasc al ---------------------------------------------------------------------- Leledumbo · 2009-06-04 07:58 What if you remove the Pointer typecast? And what's the type of: Py_InitModule4 DLL_PyArg_ParseTuple PyCallable_Check PyBool_FromLong