Calling C Code from IDL Modules

David Fanning has some excellent advice and useful info about calling C from IDL.


(From David Fanning):

  • All arrays which need to be passed between IDL and C must be allocated in IDL. This includes both arrays being passed from IDL to C and from C back to IDL. Sometimes this requires an initial call to the C code to return the array sizes which IDL will allocate, if the array sizes are not known to IDL beforehand.
  • Don't deallocate any arrays which were passed from IDL.
  • Don't pass strings, rather pass byte arrays. It is much simpler. Convert strings to byte arrays in IDL before or after the Call_External call.
  • Convert all output variables to the data type which C is expecting in the Call_External call.



-- ElizabethAuden - 11 May 2005

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | More topic actions...
Topic revision: r1 - 2005-05-11 - ElizabethAuden
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback