Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-04

GetProcAddress weird problem

5 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Leonardo M. Ramé

Hi, I'm facing a weird issue with GetProcAddress in a Lazarus program

I have a method that calls GetProcAddress to get a pointer to a function in a shared library. The method can be called many times without problem.

If I try to create another method, with exactly the same content of the former, when the program executes the line with GetProcAddress, an SIGSEGV is raised. If I debug this line, I get a different pointer address than in the original method.

Does anyone knows why this happens?.

Free Pascal Compiler version 2.5.1 [2011/04/10] for x86_64 Lazarus 0.9.31 - r30261M

Leonardo M. Ram? Medical IT - Griensu S.A. Av. Col?n 636 - Piso 8 Of. A X5000EPT -- C?rdoba Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19 Cel.: +54(351)156629292

Reply by email

zeljko
to Leonardo M. Ramé
Leonardo M. Ram? wrote 12 lines
Hi, I'm facing a weird issue with GetProcAddress in a Lazarus program I have a method that calls GetProcAddress to get a pointer to a function in a shared library. The method can be called many times without problem. If I try to create another method, with exactly the same content of the former, when the program executes the line with GetProcAddress, an SIGSEGV is raised. If I debug this line, I get a different pointer address than in the original method. Does anyone knows why this happens?.

My crystal ball is off atm, so please write at least piece of code so we can try to understand what could be your problem.

zeljko

Reply by email

Leonardo M. Ramé
to zeljko
zeljko wrote 20 lines
On Wednesday 20 of April 2011 16:20:52 Leonardo M. Ram? wrote: > Hi, I'm facing a weird issue with GetProcAddress in a Lazarus program > > I have a method that calls GetProcAddress to get a pointer to a function > in a shared library. The method can be called many times without > problem. > > If I try to create another method, with exactly the same content of the > former, when the program executes the line with GetProcAddress, an > SIGSEGV is raised. If I debug this line, I get a different pointer > address than in the original method. > > Does anyone knows why this happens?. My crystal ball is off atm, so please write at least piece of code so we can try to understand what could be your problem. zeljko --

Nevermind, both methods weren't exactly equal.

Reply by email

zeljko
to Marco van de Voort
Marco van de Voort wrote 8 lines
On Wed, Apr 20, 2011 at 11:20:52AM -0300, Leonardo M. Ram? wrote: > Hi, I'm facing a weird issue with GetProcAddress in a Lazarus program > > I have a method that calls GetProcAddress to get a pointer to a function > in a shared library. The method can be called many times without > problem. Multiple dyn loading of the same lib through loadlibrary maybe?

Or library already loaded, but from another app and not from LD_LIBRARY_PATH. I had same problem with xulrunner and sqlite.
libsqlite-3 is in /usr/lib and in /usr/lib/xulrunner and with different versions (xulrunner one was 3-4 minor versions down). If I started firefox , and then app which loads libsqlite - crash.
Removing libsqlite-3 from /usr/lib/xulrunner and adding symlink to /usr/lib/libsqlite-3 fixed my problem.
But I'm wondering now is it fpc problem ,since other apps takes /usr/lib/libsqlite-3 and works ok (even have test C code which dynamically loads libsqlite-3 in same manner as fpc do, but that C example works and fpc one not ... don't ask me for this example project...I don't know where it is ).

zeljko

Reply by email