title: IDL CALL_EXTERNAL crashing when passing arguments to C++
body: <p>I'm trying to run a c++ script from IDL using the CALL_EXTERNAL function. I've been able to get it to work without arguments, but when I try to add an arg, such as a single IDL LONG INT, IDL crashes. with the error:</p>
  
  <pre><code>% CALL_EXTERNAL: Error loading sharable executable.
                   Symbol: main, File = /home/inspired/workspace/TestCode/main.
                   so
                   /home/inspired/workspace/TestCode/main.so: wrong ELF class:
                   ELFCLASS64
  % Execution halted at: TEST_EXTERNAL       7
    /home/inspired/IDLWorkspace/Analyze Data/test_external.pro
  %                      $MAIN$    
  </code></pre>
  
  <p>The test code I'm using is as follows.</p>
  
  <p>The C++ code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main(int argc, char *argv[]) {
      int temp = (int) strtod(argv[1], NULL);
      std:cout&lt;&lt;temp;
      return temp;
  }
  </code></pre>
  
  <p>The IDL code:</p>
  
  <pre><code>pro test_external
   c= call_external('/home/inspired/workspace/TestCode/main.so','main', long(2), /AUTO_GLUE)
   print,c
  end
  </code></pre>
  
  <p>This code is of course practice code, but if I can't get this to work, then there's no way I'll be able to pass a mixture of arrays, and values.</p>
  
  <p>I am aware that IDL passes everything by reference unless stated otherwise. So I've tried both treating the passed argument as a pointer in the C++ code, and setting the /ALL_VALUE keyword to pass the arg as a value. Neither works resulting in the same error as above. I've read about "glue functions" but I have not been able to find a guide to making them (despite every source indicating that it's 'easy for most programmers'" >.></p>
  
  <p>Anyway, my options are as follows, and if you can help me with any, I'd be eternally grateful:</p>
  
  <ol>
  <li>Get this CALL_EXTERNAL function to work</li>
  <li>Have the C code grab the data it needs from memory somehow</li>
  <li>Rewrite everything in C++ (you don't need to help with this one)</li>
  </ol>
  
  <p>Thanks in advance.</p>