0

I have a file A.c and another file B.c, There is a function func1 in A.c which is defined in B.c and a function func2 in B.c which is defined in A.c. Now when I am trying to build the separate so library with A.c and B.c, then the compiler throws circular dependency error at linking time. So is there any way so that I can link the two libraries together? Or I can make the linking delayed i.e libA.so will not link until libB.so is compiled.

For Example :-

File A.h :-

void func1();

File A.c

void func1()
{
   printf ("Hello A");
}

void other_function()
{
   func2();
}

File B.h

void func2();

File B.c

void func2()
{
  printf("Hello B");
}

void other_function ()
{
    func1();
}

1 Answers1

-1

We can achieve this kind of linking by using static library instead of shared library. I used that and it worked.