let 
    function find_library(libname,filename)
        try 
            dl = dlopen(joinpath(Pkg.dir(),"Clang","deps","usr","lib",filename))
            ccall(:add_library_mapping,Int32,(Ptr{Uint8},Ptr{Uint8}),libname,dl)
        catch
            try 
                dl = dlopen(libname)
                dlclose(dl)
            catch
                error("Failed to find required library "*libname*". Try re-running the package script using Pkg.runbuildscript(\"pkg\")")
            end
        end
    end
    find_library("libwrapclang","libwrapclang")
end

let 
    function find_library(libname,filename)
        try 
            push!(DL_LOAD_PATH, joinpath(Pkg.dir(), "Clang", "deps", "usr", "lib"))
            dl = dlopen(libname)
        catch
            try 
                dl = dlopen(libname)
                dlclose(dl)
            catch
                error("Failed to find required library "*libname*". Try re-running the package script using Pkg.runbuildscript(\"pkg\")")
            end
        end
    end
    find_library("libwrapclang","libwrapclang")
end

Remove deprecated bindeps dlpath call
Remove deprecated bindeps dlpath call
