Hi,

You can also do it with manifests. The example attached manifests allow an executable in directory c:\bin to load libstdc++-6.dll and libgcc_s_sjlj-1.dll from a subdirectory. Nothing is needed other than the manifests. The subdirectory is not on the PATH.

The directory and file structure is:

C:\bin\myexecutable.exe
C:\bin\mylocalassembly\mylocalassembly.manifest
C:\bin\mylocalassembly\libstdc++-6.dll
C:\bin\mylocalassembly\libgcc_s_sjlj-1.dll

The attached 'application.manifest' is compiled into myexecutable.exe.
The plain text file 'mylocalassembly.manifest' is also attached.

In brief - the manifest compiled into myexecutable.exe says it has a dependency on assembly 'mylocalassembly'. The windows loading mechanism will treat the subdirectory 'mylocalassembly' as containing the required assembly. You can add whatever you like to the 'file' list in mylocalassembly.manifest

It is an excellent way of solving the conflicting 'libgcc on path' problem. It would also allow myexecutable32.exe and myexecutable64.exe to be in the same directory and have the same PATH - just have different assembly dependencies.

Works for Windows XP onwards.

Note that the Windows loading mechanism is quite sensitive to the manifest format so make sure your format is the same as example. processorArchitecture for 32 bit is "x86", for 64 bit "amd64". Note the lower case. Different versions of Windows are fussier than others.

Hope it helps.



On 26/10/2012 16:34, Kai Tietz wrote:
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:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity type="win32"
                    name="MyApplication.Application"
                    version="2.0.0.0"
                    processorArchitecture="x86" />
  <description>MyApplication.Application</description>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32"
                        name="Microsoft.Windows.Common-Controls"
                        version="6.0.0.0"
                        language="*"
                        processorArchitecture="*"
                        publicKeyToken="6595b64144ccf1df" />
    </dependentAssembly>
  </dependency>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32"
                        name="mylocalassembly"
                        version="1.0.0.0"
                        language="*"
                        processorArchitecture="x86" />
    </dependentAssembly>
  </dependency>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false" />
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
    <noInheritable></noInheritable>
    <assemblyIdentity type="win32" name="mylocalassembly" version="1.0.0.0" processorArchitecture="x86" ></assemblyIdentity>
    <file name="libstdc++-6.dll"></file>
    <file name="libgcc_s_sjlj-1.dll"></file>
</assembly>
------------------------------------------------------------------------------
WINDOWS 8 is here. 
Millions of people.  Your app in 30 days.
Visit The Windows 8 Center at Sourceforge for all your go to resources.
http://windows8center.sourceforge.net/
join-generation-app-and-make-money-coding-fast/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to