K
kid joe
Hi all,
Im very confused about how you should provide inline functions in a
library. Lets say the library is libjoe with headerfile <joe.h>. There
seem to be a few possibilities:
1) have the function defined in joe.h as static inline.
2) have the function defined in joe.h as inline and also include
an extern inline prototype for it in joe.h. (Make sure to use #pragma once
in joe.h)
3) have the function defined as inline in one of the *.c files
that make up libjoe, and put an extern inline prototype in joe.h.
Which of these is the best?
Also I guess it shouldnt be possible to call a private function from
libjoe (ie a static function in one of the *.c files that make up libjoe)
inside an inline function exported by libjoe, even though it would be
possible to call a static function in a non-inline function exported by
libjoe. How is that enforced? Is it by the compiler or the linker?
Cheers,
Joe
Im very confused about how you should provide inline functions in a
library. Lets say the library is libjoe with headerfile <joe.h>. There
seem to be a few possibilities:
1) have the function defined in joe.h as static inline.
2) have the function defined in joe.h as inline and also include
an extern inline prototype for it in joe.h. (Make sure to use #pragma once
in joe.h)
3) have the function defined as inline in one of the *.c files
that make up libjoe, and put an extern inline prototype in joe.h.
Which of these is the best?
Also I guess it shouldnt be possible to call a private function from
libjoe (ie a static function in one of the *.c files that make up libjoe)
inside an inline function exported by libjoe, even though it would be
possible to call a static function in a non-inline function exported by
libjoe. How is that enforced? Is it by the compiler or the linker?
Cheers,
Joe