how to use indirect funtions?

Carlos O'Donell carlos@systemhalted.org
Wed Jul 18 01:03:00 GMT 2012


On Fri, Jul 6, 2012 at 7:39 AM, Ondřej Bílka <neleai@seznam.cz> wrote:
> Hello
>
> I want to do dispatching of my string functions in generic way.
> Currently for strstr I have files strstr_sse2.c, strstr_ssse3,
> strstr_sse4_1.c, strstr_sse4_2.c, each consisting only of three lines
>
>
> #define USE_FOO
> #define STRSTR __strstr_FOO
> #include "strstr.h"
>
> As I want do same thing for all string functions. This would generate
> lot of files. Is there better way how to do this?

That seems like a reasonable solution to the problem.

I haven't thought it through very much, but I don't see an easy way to
solve it in one file.

You might be able to just have one file and a bunch of inline assembly
inserts that create symbol aliases in the assembler.

Cheers,
Carlos.



More information about the Libc-help mailing list