# How to indicate a specific path to julia libdl find_library()?

copy paste of this thread :

I’m trying to indicate a specific path to `find_library()`. Based on the doc, `find_library()`

Searches for the first library in names in the paths in the locations list, DL_LOAD_PATH, or system library paths (in that order) which can successfully be dlopen’d`

My library `foo.dll` is located at `\library\` unfortunately, I don’t know how to specify it !

### 1st try : Set the `location` inside find_library()

``````const _LIB = find_library("foo.dll", raw"\library")` gave me the following error :
MethodError: no method matching joinpath(::Char, ::String) Closest candidates are: joinpath(::AbstractString, ::AbstractString...)
``````

### 2nd Try : Set `DL_LOAD_PATH`

``````DL_LOAD_PATH = raw"../library" (or `DL_LOAD_PATH = raw"/library`) but then : `_LIB==""`
``````

NB : The dll is readable : actually, my code can find it if i place it in my windows path, but i would like to make something more portable)

EDIT :

my path :

``````.
├── library
│   └── foo.dll
└── src
├── MyPackage.jl
└── types.jl
``````

Thanks a lot

On Windows, you should use `PATH`(edit the system environment variable) instead of `DL_LOAD_PATH`.

Hi, thanks for your answers. Is there a way to specify the path inside my julia script (with find_library for instance) ?

you could use an absolute path(don’t forget to norm it with `normpath`).

Unfortunately, I’m still not able to use find_library with my path

`````` LoadError: MethodError: no method matching joinpath(::Char, ::String)
Closest candidates are:
joinpath(::AbstractString, ::AbstractString...) at path.jl:255
``````

??

### what I tried :

``````CURRENT_PATH = @__DIR__  # "C:\\Users\\julie\\mypackage\\src"
DL_LOAD_PATH = joinpath(@__DIR__, "..", "library") #"C:\\Users\\julie\\mypackage\\src\\..\\library"
const _LIB = find_library("Bid.dll", DL_LOAD_PATH) #ERROR ?
``````

Could you try `find_library(joinpath(DL_LOAD_PATH, "Bid.dll"))`? IIRC, the second argument of `find_library` should be a `Vector`, so this might also work: `find_library("Bid.dll", [DL_LOAD_PATH])`

`const _LIB = find_library("Bid.dll", [DL_LOAD_PATH])` worked like a charm, thanks a lot !