Skip to content

Instantly share code, notes, and snippets.

@marciok
Created June 13, 2016 13:34
Show Gist options
  • Save marciok/cf016a40b3718fbc59aa205412a8188c to your computer and use it in GitHub Desktop.
Save marciok/cf016a40b3718fbc59aa205412a8188c to your computer and use it in GitHub Desktop.
require 'fiddle/import'
module PonyScale
extend Fiddle::Importer
dlload '.build/release/libPonyScale.dylib' # dylib generated by SPM
extern 'double _TF9PonyScale15calculateWeightFT4massSd_Sd(double)' # `calculateWeight(_:)` mangled name
end
weight = PonyScale::_TF9PonyScale15calculateWeightFT4massSd_Sd(18) # Calculating weight by passing 18 as mass
puts "Your pony weighs: #{weight}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment