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
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to