2

I want to try with different glibc's sin functions. Is their a way to use sin function of different glibc versions without compiling the entire glibc?

i have downloaded different versions of glibcs on my virtual ubuntu machine. I do find the source of sin function. Is there a way to use the different 'sin' without compiling its full glibc?

zell
  • 9,830
  • 10
  • 62
  • 115
  • Depending on how much it depends on, you can just copy it to a file in your project. – Linuxios Oct 27 '14 at 19:17
  • @linuxios Oh, it does depends on a lot: #include #include "endian.h" #include "mydefs.h" #include "usncs.h" #include "MathLib.h" #include #include – zell Oct 27 '14 at 19:37
  • I mean the specific function. What functions does it call? – Linuxios Oct 27 '14 at 19:38
  • 1
    Just statically link your executable. It will link only the required functions! (But there are some pitfalls, e.g. NSS). – Basile Starynkevitch Oct 27 '14 at 19:43
  • @Basile Starynkevitch What are the potential pitfalls, pls? – zell Oct 27 '14 at 19:52
  • http://stackoverflow.com/a/11693411/841108 – Basile Starynkevitch Oct 27 '14 at 19:53
  • @Basile Starynkevitch Sorry but what do you mean by "link only the required functions"? Already, there are a bunch of header files in the source file of 'sin' that we have almost no clue where to find them. In addition, the are a bunch of macros in the source file. In particular, the function 'sin' does not exist anywhere in the source file of 'sin' (s_sin.c). They use macros and we have totally no clue which function to call... Do you mean I can just use gcc -c -o a.out ? Maybe I miss something? – zell Oct 27 '14 at 20:47
  • Please edit your question to improve it. BTW, look also inside [musl-libc](http://musl-libc.org/). Notice that you don't [link](https://en.wikipedia.org/wiki/Linker_%28computing%29) *source* files but only [*object files*](https://en.wikipedia.org/wiki/Object_file). And explain what different `sin` functions did you find in *glibc* – Basile Starynkevitch Oct 28 '14 at 03:26

1 Answers1

0

I think your best choice is to copy the function code into your sources and fill in all the missing functionality - functions that sin calls, all (if any) constants etc. Might not be a simple task

jmajnert
  • 418
  • 4
  • 8