Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • cmucl cmucl
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 36
    • Issues 36
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • cmucl
  • cmuclcmucl
  • Issues
  • #74

Closed
Open
Created Feb 10, 2019 by Anton Vodonosov@avodonosov1

What is the best way to write code for foreign functions which may be absent (removed / renamed)?

OpenSSL often renames functions, even the function which returns OpenSSL version number is renamed from SSLeay to OpenSSL_version_num.

Code like this:

(ignore-errors
 (cffi:defcfun ("SSL_CTX_set_default_verify_dir" ssl-ctx-set-default-verify-dir)
     :int
   (ctx :pointer)))

fails despite ignore-errors if the foreign function is absent (the libssl.so version loaded doesn't have it).

It fails when the fasl file containing this code is loaded:

KERNEL:SIMPLE-PROGRAM-ERROR: Undefined foreign symbol: "SSL_CTX_set_default_verify_dir"

The same failure even if we modify the code this way:

(when nil
 (cffi:defcfun ("SSL_CTX_set_default_verify_dir" ssl-ctx-set-default-verify-dir)
     :int
   (ctx :pointer)))

Is there a way to not fail when the function is absent? Preferably such that supports saving and loading lisp image, probably with another version of the foreign library, where different sets of functions are removed / added.

Edited Feb 10, 2019 by Anton Vodonosov
Assignee
Assign to
Time tracking