[fpc-pascal] CMEM experiences in DLL

L505 fpc505 at z505.com
Sat Jan 14 14:13:14 CET 2006

In linux I get a segmentation fault at the very end of an executable program when
using cmem.pp in a DSO and executable combination. (simple hello world not even
calling the function - just importing it itself is the problem). If the imported
function is commented out,
there is no segmentation fault.

When using cmem in regular executable elf programs and not calling a library that
uses cmem, the cmem works without trouble.

On MS Windows using cmem does not seem to cause segmentation fault on simple hello
world dll and exe combination program.

I tried fpc version 2.0.2 and 2.0.0 and 2.1.1 with all the same behavior. I guess
I'll file a simple bug report since any function doesn't work (even when not using
ansistrings). Actually the program seems to run fine, i.e. the functions work and the
programs run through till the end, just at the very end of the program you get a
segmentation fault. Probably something to do with a variable being freed. I don't
think it's the
  SetMemoryManager (OldMemoryManager);
function in cmem's finalization section, because I commented that line out and it
still gave segmentation fault.

More information about the fpc-pascal mailing list