How to run c program with .so file
<p>I have gone through all the solutions on StackOverflow as well as Ask Ubuntu.</p>

<p>I have a Go program:</p>

<pre><code>package main

import "C"

//export Getint
func Getint() int {
        return  2
}

func main() {}
</code></pre>

<p>and I have generated <code>.so</code> file for the same with name <code>t.so and header file</code>t.h`</p>

<p>Now I would like to use this function in my C program.<br>
I have written the code but I don't know how to execute it.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;t.h&gt;
int main()
{
int a;
a=Getint();
printf("number : %d",a);
return 0;
}
</code></pre>

<p>When I execute it with</p>

<pre><code>gcc c.c t.so
</code></pre>

<p>it generates <code>a.out</code> file</p>

<p>but at the time of running <code>a.out</code> with <code>./a.out</code> it gives an error:</p>

<pre><code>./a.out
Error while loading shared libraries: t.so: can not open shared object file: no such file or directory exists.
</code></pre>

<p>then I tried with:</p>

<pre><code>gcc -c c.c -l t.so
</code></pre>

<p>So it generates <code>c.o</code> file and it is not executable.</p>