title: How to access the global variable of executable in shared library (c - linux)
body: <p>I want to access the global variable of executable in shared library? I have tried to compile using option -export-dynamic  but no luck.</p>
  
  <p>I have tried with extern key word. this also not working.</p>
  
  <p>Any help or suggestion would be appreciable. </p>
  
  <p>Environment c - Linux</p>
  
  <p>executable:- 
  tst.c</p>
  
  <pre><code>int tstVar = 5;
  
  void main(){
  funInso();
      printf("tstVar %d", tstVar);
  }
  </code></pre>
  
  <p>lib:-
  tstLib.c</p>
  
  <pre><code>extern int tstVar;
  
  void funInso(){
     tstVar = 50;
  }
  </code></pre>
  
  <p>Since my code is very big, I just gave the sample which I have used in my program.</p>