title: Calling a function in a .cpp file from a .c file
body: <p>I've been struggling to solve a problem with a project I'm working on.
  Lets assume I have a few files:</p>
  
  <pre><code>reflection.h 
  sll_insert.c
  record_sll.c
  io_recorder.cpp
  </code></pre>
  
  <p>all of the above mentioned cpp and c files use:</p>
  
  <pre><code>#include "reflection.h"
  </code></pre>
  
  <p>and in <code>"reflection.h"</code> are the following declarations:</p>
  
  <pre><code>extern void io_recorder_fun_entry(char * name, TypedObject args[], int len);
  
  extern void io_recorder_fun_exit(char * name, TypedObject args[], int len);
  </code></pre>
  
  <p>These two functions are implemented in <code>"io_recorder.cpp"</code> and they use another function from <code>"io_recorder.cpp"</code> called <code>io_record</code>.</p>
  
  <p>now, in <code>"io_recorder.cpp"</code>, the two functions are as follows:</p>
  
  <pre><code>extern "C" void io_recorder_fun_entry(char * name, TypedObject args[], int len) {
      cout &lt;&lt; "Entering function "&lt;&lt; name &lt;&lt; endl; 
      io_record(args, len);
  }
  
  extern "C" void io_recorder_fun_exit(char * name, TypedObject args[], int len) {
      cout &lt;&lt; "Exiting function "&lt;&lt; name &lt;&lt; endl; 
      io_record(args, len);
  
  }
  </code></pre>
  
  <p>When in <code>io_record, there are calls being made to several functions declared in reflection.h and implemented in</code>"record_sll.c"`.</p>
  
  <p>I have 2 questions:</p>
  
  <ol>
  <li><p>The connection between C and C++ is not working for me in that case (i have experimented with it previously with other files and it seemed to work before).
  When trying to compile I receive errors like:</p>
  
  <p><code>io_recorder.cpp: In function ‘void io_recorder_fun_entry(char*, TypedObject*, int)’:</code></p>
  
  <p><code>io_recorder.cpp:61:79: error: conflicting declaration of ‘void io_recorder_fun_entry(char*, TypedObject*, int)’ with ‘C’ linkage
  tern "C" void io_recorder_fun_entry(char * name, TypedObject args[], int len) {</code></p>
  
  <p>In file included from <code>io_recorder.cpp:4:0:
  reflection.h:32:13: note: previous declaration with ‘C++’ linkage
  extern void io_recorder_fun_entry(char * name, TypedObject args[], int len);</code></p></li>
  </ol>
  
  <p>Obviously I did something wrong and I can't figure out what.
  What am I supposed to change in order for it to compile properly?</p>
  
  <ol start="2">
  <li>In previous errors, it appeared that <code>io_record</code> did not recognize the functions from <code>record_sll</code> when I used them.
  Does it have anything to do with the errors from question 1? If not, what should I do to make sure <code>io_record</code> knows them.</li>
  </ol>
  
  <p>Thanks in advance for the help, I hope i can fix this soon.</p>