2012/10/26 Алексей Павлов <[email protected]>:
> Hi!
> Can I link program with shared library that not in PATH by relative path on
> windows? I have structure like below:
>
> ORIGIN
>   |- bin
>   |   \-program.exe
>   |- opt
>   |   |-lib
>   |   |   \-mylib.dll

Yes, this is possible.  But DLL loading mechanism works different to
that one you know from ELF systems.

> I try to add arguments to LDFLAGS
>   Wl,-rpath,'../opt/lib' -L/path/to/lib -lmylib
> But without success(

Yes, that won't work.

Common solution for this is to add sub-directory to PATH before
execution of application.  This can be done by a stub-application,
which just modifies PATH and then executes *real* app.
Other way to solve this is by using delayed and/or manual DLL loading
code.  By delayed version you can modify PATH variable local to your
own app before calling external DLL code, or you are using LoadLibrary
directly, where you can specify any path for DLL to be loaded.

Hopes this helps,
Kai

------------------------------------------------------------------------------
The Windows 8 Center 
In partnership with Sourceforge
Your idea - your app - 30 days. Get started!
http://windows8center.sourceforge.net/
what-html-developers-need-to-know-about-coding-windows-8-metro-style-apps/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to