CALL Function (LibreOffice Calc)

Advanced / External Interfaces Expert LibreOffice Calc Introduced in Legacy (pre‑LibreOffice 3.0)
external-libraries dll shared-libraries advanced legacy system-integration

The CALL function invokes a function exported from a shared library (DLL or .so). It is a legacy interface for calling native code directly from Calc formulas. This function is extremely powerful but also risky, and is disabled by default for security reasons.

Compatibility

▾

What the CALL Function Does ▾

  • Calls a function inside a native shared library
  • Passes arguments directly to compiled code
  • Returns the result to the spreadsheet
  • Supports multiple parameter types
  • Requires macro security settings to allow external code execution

Syntax ▾

Basic form

CALL(module; function; return_type; arg1; arg2; ...)

Arguments

  • module:
    Path or name of the shared library (DLL or .so).

  • function:
    Name of the exported function to call.

  • return_type:
    A string specifying the return type (e.g., “I”, “D”, “C”, “P”).

  • arg1, arg2, … (optional):
    Arguments to pass to the external function.

Supported Data Types ▾

Code Type
I Integer
D Double
C String (char*)
P Pointer
V Void (no return)

Basic Examples ▾

Call a DLL function (Windows)

=CALL("mylib.dll"; "AddNumbers"; "I"; 5; 7)

Call a shared library (Linux)

=CALL("/usr/lib/libmath.so"; "cos"; "D"; 1.0)

Call a void function

=CALL("logger.dll"; "LogEvent"; "V"; "Started")

Advanced Examples ▾

Using REGISTER.ID to simplify repeated calls

=REGISTER.ID("mylib.dll"; "Multiply"; "DII")
→ returns a function ID

Then:

=CALL(A1; 3; 4)

Passing strings to native code

=CALL("textlib.dll"; "Process"; "C"; "Hello")

Calling a function that returns a pointer

=CALL("sys.dll"; "GetHandle"; "P")

Using CALL inside a larger formula

=IF(A1>0; CALL("calc.dll"; "Compute"; "D"; A1); 0)

Edge Cases and Behavior Details ▾

CALL is disabled by default

You must enable:

  • Tools → Options → LibreOffice → Security → Macro Security
  • Allow “Execute external code” (varies by version)

Behavior details

  • If the library cannot be loaded → Err:504
  • If the function cannot be found → Err:508
  • If parameter types mismatch → Err:502
  • If the function crashes → LibreOffice may crash

Platform differences

  • Windows uses .dll
  • Linux uses .so
  • macOS support is limited

Security Considerations ▾

CALL can execute arbitrary native code

This means:

  • It can read/write files
  • It can access memory
  • It can crash LibreOffice
  • It can run malware if misused

Never enable CALL for untrusted spreadsheets.

Common Errors and Fixes ▾

Err:504 — Module not found

Fix:

  • Check library path
  • Ensure correct file extension

Err:508 — Function not found

Fix:

  • Verify exported symbol name
  • Check case sensitivity

Err:502 — Invalid argument

Fix:

  • Ensure correct type codes
  • Validate argument count

Best Practices ▾

  • Use CALL only when absolutely necessary
  • Prefer UNO API or macros for modern integrations
  • Keep DLLs in trusted locations
  • Document parameter types clearly
  • Disable CALL in shared environments
CALL is a legacy power tool — extremely flexible, but risky. Use it only when you must interface Calc with compiled native code.

Related Patterns and Alternatives ▾

  • REGISTER.ID — register external functions
  • DDE — dynamic data exchange
  • HYPERLINK — open external resources
  • INDIRECT — dynamic references
  • UNO macros — modern automation

By understanding CALL, you can integrate LibreOffice Calc with native code, but always with caution and strict security controls.

Copyright 2026. All rights reserved.