IDL accesses the IRBEM Fortran library through IDL’s built-inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/PRBEM/IRBEM/llms.txt
Use this file to discover all available pages before exploring further.
CALL_EXTERNAL function, which loads a shared library (.so on Linux/Unix, .dll on Windows) and invokes a named symbol directly. No intermediate MEX or wrapper compilation step is required — you only need the compiled shared library on disk and the correct CALL_EXTERNAL invocation in your IDL code.
Locating the shared library
The IRBEM build system produces the shared library aslibirbem.so (Linux/Unix) or libirbem.dll (Windows). The most portable way to construct the full lib_name path inside an IDL script is to branch on the !version.os system variable:
Critical type requirements
The two rules that prevent nearly all type-mismatch crashes:| Fortran type | Required IDL type | IDL declaration |
|---|---|---|
INTEGER (32-bit) | LONG | var = 0L or LONG(value) |
DOUBLE PRECISION (64-bit) | DOUBLE | var = 0.0D or DOUBLE(value) |
INT (16-bit) for Fortran integers, and never use IDL FLOAT (32-bit) for Fortran double-precision arguments. These are the most common sources of silent crashes.
String / character arguments
FortranCHARACTER outputs (e.g. format strings or label fields) must be declared as byte arrays in IDL. Use BYTARR(n) where n matches the declared length of the Fortran character variable:
STRING(char_out).
Calling make_lstar via CALL_EXTERNAL
The example below computes magnetic coordinates for a single spacecraft position. All variables are declared explicitly to satisfy the strict type requirements.
The trailing underscore in
'make_lstar1_' reflects the symbol name that the Fortran compiler emits on Linux. On some platforms the symbol may have a different number of trailing underscores — if CALL_EXTERNAL raises an “unresolved symbol” error, inspect the shared library with nm -D libirbem.so | grep make_lstar to confirm the exact symbol spelling.The VALUE keyword
CALL_EXTERNAL passes all arguments by reference by default. For scalar arguments that Fortran expects to receive by reference (which is the Fortran default for all arguments), this is correct. The VALUE keyword accepts a byte array that selects, per argument position, whether the argument is passed by value (1B) or by reference (0B). For standard IRBEM calls, pass all arguments by reference (0B).
Array layout
IRBEM uses Fortran (column-major) array ordering. Themaginput array is declared DOUBLE PRECISION maginput(25, NTIME_MAX) in Fortran. In IDL, which is also column-major by default, you can declare it as DBLARR(25, ntime). For a single time step, a flat DBLARR(25) is equivalent.
Next steps
For the complete list of IRBEM subroutines, their full calling sequences, and descriptions of all input/output parameters, see the API Reference. Each function entry includes the Fortran subroutine signature from which theCALL_EXTERNAL argument list is derived directly.