[fpc-devel] Linking problem

Ivo Steinmann ivo_steinmann at gmx.net
Sun Sep 24 11:02:53 CEST 2006


Ivo Steinmann wrote:
> Hello all
>
> I tried to link libmodplug.so but get this error:
>
> /usr/lib/libmodplug.so: undefined reference to `operator 
> new[](unsigned int)'
> /usr/lib/libmodplug.so: undefined reference to `operator delete(void*)'
> /usr/lib/libmodplug.so: undefined reference to `operator delete[](void*)'
> /usr/lib/libmodplug.so: undefined reference to `operator new(unsigned 
> int)'
>
> do I have to link another library also (something like libstd) or is 
> there a way that I can define those function in my application? Im a 
> littlebit confused about "operator"
>
>

I found my own solution (and that's working for linux here). But I dont 
know if it's a bad idea to do it. linking libstdc++ leads to other 
problems here, so I cant do that. Flawless and me have got a unit that 
implements some parts of stdlibc++, so I took the functions above from 
this lib.

function cppNew(s: cint): pointer; cdecl; public; alias : '_Znaj'; alias 
: '_Znwj';
begin
  GetMem(Result, s);
end;

procedure cppDelete(p: pointer); cdecl; public; alias : '_ZdlPv'; alias 
: '_ZdaPv';
begin
  FreeMem(p);
end;

now it compiles and works without any problems. What do you think? 
dangerous? crazy? If you think it's a good idea, I would like to add a 
unti called  fpcstdcpp or something like that. This unit defines other 
things also, like fdiv, etc...

-Ivo Steinmann



More information about the fpc-devel mailing list