Archived

This topic is now archived and is closed to further replies.

Evil Bill

Inline functions in a .lib

Recommended Posts

Hi, I''m trying to write a math library, but i can;t get inline functions to work. If, in the header i have this: inline int ToInt(float f); then i get an unresolved external symbol in the app i test my lib with. It works if i take away the "inline" bit, but obviously it won;t be inlined. I know this is because inlien functions only have internal linking, and so the function only exists in the .libs source. Is there a way around this apart from defining the function itself in the header? Its probably something really obvious that i''m missing. Cheers, Steve Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites
inline functions by their very nature MUST be in
the header file. There is no other way around it.

If functions are not in the header, they are NOT inline
(outline maybe?).



Kami no Itte ga ore ni zettai naru!

Share this post


Link to post
Share on other sites
I thought that it might be different with .libs. Since the source is availiable to every source file in the project (inline functions are only availiable to the .obj that they are defined in).

I''ll just do a #include "CFMath.inl" at the end of the header, and define all the functions in there - that keeps things nice and tidy.

Cheers, Steve

Steve
DirectX Programmer
Soon to be the new Bill Gates

Share this post


Link to post
Share on other sites