view lua/luadyncall/test/test_path.lua @ 63:9b6cdffd30dd

- further fixes of inccorect overflow errors for int (and long on LLP64 systems) * prev commit had bugs * added overflow tests for also int, long, long long (for both, lp64 and llp64) - while at it, fixing a reference leak when not using python with utf8 caching
author Tassilo Philipp
date Sun, 19 May 2024 15:33:18 +0200
parents 0cfcc391201f
children
line wrap: on
line source

require "path"
require "dynload"

function init(env,syspath)
  local env = env or "LIBPATH"
  local syspath = syspath or ";?.framework/?;lib?.dylib;"
  print("env\t="..env)
  print("syspath\t="..syspath)
  local path = pathinit(env,syspath)
  print("path\t="..path)
  return(path)
end

local mypath = init()

function findlib(name)
  local found, location = pathfind(mypath, name, loadlib)
  if found then 
    print("found at " .. location .. " ( object= " .. tostring(found) .. " )" ) 
  else
    print("FAILED: findlib('"..name.."'). tried:\n - " .. table.concat(location,"\n - ") .. "\n" )
  end
end

function trylib(name)
  print("trylib",name)
  local status, msg = pcall( findlib, name )
  print(status,msg)
end

trylib("GL")
trylib("OpenGL")
trylib("SDL")
trylib("Bla")