0

I got a couple of *.o files, which have defined functions, and will be used as library in the future. I need to do the unit test for those functions.

I have linked those *.o files in my testing environment(Eclipse, Linux, Google Test),so, my questions are:

  1. Do I need to do any other extra configurations in order to test those functions?
  2. How can i see the function name and arguments? Or i need to ask the developer who developed this library?
  3. How can I call the function inside those *.o object files? Do I need to link them into a static library o dynamic library first? But I don't have the privilege to access those source codes.

Thanks a lot.

Joweil
  • 3
  • 4
  • For libraries that I have used so far, I have never seen a library that doesn't let you have a header file that contains the details you require. Else if doesn't make any sense in having such a library. – WedaPashi Oct 08 '15 at 10:27
  • @WedaPashi exactly. Because I even do not know the function name and argument – Joweil Oct 08 '15 at 10:35

1 Answers1

0

If you don't have header files for the object files you need to reverse their exports and create the header file yourself. From that point on you can use them from your code and link the object files in later on.

Here is an answer that can tell you how to do this: How do i find out what all symbols are exported from a shared object?

Community
  • 1
  • 1
Marged
  • 10,577
  • 10
  • 57
  • 99
  • oh, thanks a lot. I also executed the nm command and dump command to reverse the object file to obtain the headers. – Joweil Oct 08 '15 at 14:30