[fpc-devel] Linking problem

Christian Iversen chrivers at iversen-net.dk
Sun Sep 24 19:14:34 CEST 2006


On Sunday 24 September 2006 11:02, Ivo Steinmann wrote:
> 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.
>
> [...]
>
> now it compiles and works without any problems. What do you think?
> dangerous? crazy? 

I don't think so. Since every call to new _must_ be matched by a call to 
delete, we can be sure that there are no special functions for clearing a 
pointer.

> 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...

I like it, that's why I made the original unit :D

Really, many things can compile with just a few simple functions (like those 
you used here).

Maybe we could use littlelibcpp.pas as a base for fpstdcpp.pas?

-- 
Regards,
Christian Iversen



More information about the fpc-devel mailing list