E
evan
Hi, I've got an easy one...
I need to inline a few functions from one module to another. By looking
at the compiled code I can see that the function is inlined if it is
called from within the same module but not if it is called from a
second module i.e. extern inline.
For example (extremely simplified),
inline void Bob(void)
{
printf("Bob\n");
}
void Ted(void)
{
printf("Ted"\n");
Bob();
}
produces...
void Ted(void)
{
printf("Bob\n");
}
but if I now refer to 'Bob' from an external file, nothing happens...
in names.c...
inline void Bob(void)
{
printf("Bob\n");
}
and in getnames.c...
extern inline void Bob(void);
void GetNames(void)
{
Bob();
}
produces...
void GetNames(void)
{
Bob();
}
I would have expected...
void GetNames(void)
{
printf("Bob\n");
}
I am using the gcc compiler. I thought that maybe it needed the -O
option (as suggested in the help files), but have had no luck.
Am I doing something wrong?
/evan
I need to inline a few functions from one module to another. By looking
at the compiled code I can see that the function is inlined if it is
called from within the same module but not if it is called from a
second module i.e. extern inline.
For example (extremely simplified),
inline void Bob(void)
{
printf("Bob\n");
}
void Ted(void)
{
printf("Ted"\n");
Bob();
}
produces...
void Ted(void)
{
printf("Bob\n");
}
but if I now refer to 'Bob' from an external file, nothing happens...
in names.c...
inline void Bob(void)
{
printf("Bob\n");
}
and in getnames.c...
extern inline void Bob(void);
void GetNames(void)
{
Bob();
}
produces...
void GetNames(void)
{
Bob();
}
I would have expected...
void GetNames(void)
{
printf("Bob\n");
}
I am using the gcc compiler. I thought that maybe it needed the -O
option (as suggested in the help files), but have had no luck.
Am I doing something wrong?
/evan