[fpc-pascal] fp libraries do not like cmem ?

Sven Barth pascaldragon at googlemail.com
Thu Feb 13 17:13:53 CET 2014


Am 13.02.2014 17:04, schrieb Fred van Stappen:
> > Please provide a simple, self contained example that shows this problem.
> >Regards,
> >Sven
>
> Hello.
>
> Hum, i have done a simple library, with a thread and a simple program 
> calling this library.
>
> Not usefully to show it because, both using cmem are working 
> perfectly... ;-)
>
> So the problem is somewhere else.
>
> I resume: if i use cmem in uses section of uos library (without debug 
> on) it compile but i get that error when a program call the library 
> (at thread.terminate):
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x7fffe859c700 (LWP 3289)]
> 0x00007fffefe08944 in ?? ()
>    from /home/fred/uoslib/examples/lib/Linux/64bit/libuos-64.so
>
> I have then try to compile uos library with that parameters with debug :
> -MObjFPC -Scghi -O1 -gw2 -godwarfsets -gl -gv -Xg -gt -pg -vewnhi
>
> and with cmem in uses section.
>
> And now, fpc refuse to compile, focusing at cmem in uses section !
>
> >> simpleplayer.lpr(7,8) Error: Duplicate identifier "cmem"
-gv which enables valgrind profiling needs cmem, so the compiler will 
include cmem and you did include cmem. Maybe this should be checked 
somehow... I suggest you not to use -gv and -pg except for profiling of 
performance or other things where you might need profiling.
> I do not understand, i never declare cmem somewhere else, why does the 
> debugger say me that ?
compiler, not debugger
> (and sure, that is the problem=>solution).
>
> Here the uses section :
> uses
>  {$IFDEF UNIX}
>  cthreads,
>  cwstring, {$ENDIF}
>   cmem,  // => debugger focus here, saying "Error: Duplicate 
> identifier "cmem" ??
compiler, not debugger
>   ctypes, uos;

Put cmem at the first location of the library's uses clause (before the 
ifdef).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20140213/ba8d9ef5/attachment.html>


More information about the fpc-pascal mailing list