Sign in Join

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

Mailing lists / lazarus / 2012-06

Shared libraries, cmem and heaptrc

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Mark Morgan Lloyd

Before cautiously tackling a shared library, I thought I'd have a trial run with cmem in the program that's going to call it. I find that if I put 'cmem, heaptrc' at the start of the .lpr it runs and I get heaptrc output, /but/ one of the files has a wildly erroneous error number.

If I remove both cmem and heaptrc from the .lpr I still get the error, despite having carefully removed all binaries etc. Is there a cache somewhere that also needs to be cleared?

Call trace for block $B64BB780 size 33
$08074E2A REALLOCMEM, line 317 of
/usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/inc/heap.inc $08068830 fpc_ansistr_setlength, line 588 of
/usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/inc/astrings.inc $080681AC fpc_ansistr_concat, line 225 of
/usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/inc/astrings.inc $080D58D5 FORMAT, line 369 of
/usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/objpas/sysutils/sysformt.inc $080D5F16 FORMAT, line 930 of
/usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/objpas/sysutils/sysstr.inc $0809ED76 ALSAMIDIAVAILABLE, line 1741 of alsamidi.pas ***** $0809DD50 TUNYOKEDFRONTENDFORM__ONAFTERSHOW, line 790 of unyokedfrontendcode.pas
$08095776 TAPPLICATION__PROCESSASYNCCALLQUEUE, line 1087 of ./include/application.inc
0 1>markMLl at pye-dev-13:/usr/local/src/unyoked/trunk/frontend$

***** This file only has 925 lines, I removed stuff that wasn't needed yesterday. It contains no conditional compilation or includes, it does though have some nested functions.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Mattias Gaertner
to Mark Morgan Lloyd
Show quoted text 8 lines
Before cautiously tackling a shared library, I thought I'd have a trial run with cmem in the program that's going to call it. I find that if I put 'cmem, heaptrc' at the start of the .lpr it runs and I get heaptrc output, /but/ one of the files has a wildly erroneous error number. If I remove both cmem and heaptrc from the .lpr I still get the error, despite having carefully removed all binaries etc. Is there a cache somewhere that also needs to be cleared?

AFAIK cmem and heaptrc only change the program and not any other unit ppu/o.

But you can use Run / Clean up build files to make sure.

How do you share the shared units between library and program?

Show quoted text 22 lines
Call trace for block $B64BB780 size 33 $08074E2A REALLOCMEM, line 317 of /usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/inc/heap.inc $08068830 fpc_ansistr_setlength, line 588 of /usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/inc/astrings.inc $080681AC fpc_ansistr_concat, line 225 of /usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/inc/astrings.inc $080D58D5 FORMAT, line 369 of /usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/objpas/sysutils/sysformt.inc $080D5F16 FORMAT, line 930 of /usr/local/src/fpc/fpcbuild-2.6.0/fpcsrc/rtl/objpas/sysutils/sysstr.inc $0809ED76 ALSAMIDIAVAILABLE, line 1741 of alsamidi.pas ***** $0809DD50 TUNYOKEDFRONTENDFORM__ONAFTERSHOW, line 790 of unyokedfrontendcode.pas $08095776 TAPPLICATION__PROCESSASYNCCALLQUEUE, line 1087 of ./include/application.inc 0 1>markMLl at pye-dev-13:/usr/local/src/unyoked/trunk/frontend$ ***** This file only has 925 lines, I removed stuff that wasn't needed yesterday. It contains no conditional compilation or includes, it does though have some nested functions.

Mattias

Reply by email

Mark Morgan Lloyd
to Mattias Gaertner
Mattias Gaertner wrote 7 lines
On Fri, 08 Jun 2012 09:15:46 +0000 Mark Morgan Lloyd wrote: > Before cautiously tackling a shared library, I thought I'd have a trial > run with cmem in the program that's going to call it. I find that if I > put 'cmem, heaptrc' at the start of the .lpr it runs and I get heaptrc > output, /but/ one of the files has a wildly erroneous error number.

Should read "wildly erroneous line number".

Show quoted text 8 lines
> If I remove both cmem and heaptrc from the .lpr I still get the error, > despite having carefully removed all binaries etc. Is there a cache > somewhere that also needs to be cleared? AFAIK cmem and heaptrc only change the program and not any other unit ppu/o. But you can use Run / Clean up build files to make sure.

I did do, and checked for old files in the project directories. I'm definitely running the right binary, since I don't get heaptrc output if I disable it in the IDE options. I get the error whether or not I'm using cmem. Laz 1.1, FPC 2.6.0, Linux, GTK2, all CG range checks etc. enabled.

How do you share the shared units between library and program?

I haven't got that far yet, I'm trying to tackle it one stage at a time. But my plan is to use a class which wraps and opens the shared library on first use, that contains methods which are exact analogues of exported entry points (and can be described by a .inc file shared between the two projects).

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email