Hi Claus,
Unfortunately this approach won't work for you. Even if you decided that you'd take the size hit by GACing bigapp.exe, you'd find that it is
actually not possible to place unmanaged code into the GAC. Do you anticipate having applications that you do not distribute link against your
.dll? If not, I might recommend adding a .config file to each application that requires your new .dll and telling fusion where to look for it. This is
accomplished through the use of either a <probing> tag or a <codeBase> tag. I would recommend the following references:
* Specifying an Assembly's Location (details on <probing> and <codeBase>):
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpguide/html/cpconspecifyingassemblyslocation.asp
* How the Runtime Locates Assemblies:
http://msdn.microsoft.com/library/default.asp?url=/library/en-
us/cpguide/html/cpconhowruntimelocatesassemblies.asp
-Shawn
http://blogs.msdn.com/shawnfa --
This posting is provided "AS IS" with no warranties, and confers no rights.
Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they
originated.
--------------------
[quoted text, click to view] >Content-Class: urn:content-classes:message
>From: "Claus Brod" <claus_no_brod_spam@web.de>
>Sender: "Claus Brod" <claus_no_brod_spam@web.de>
>Subject: GAC: Installing DLL which depends on EXE
>Date: Fri, 12 Dec 2003 02:54:30 -0800
>Lines: 49
>Message-ID: <079401c3c09e$51fff300$a501280a@phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain;
> charset="iso-8859-1"
>Content-Transfer-Encoding: 7bit
>X-Newsreader: Microsoft CDO for Windows 2000
>X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
>Thread-Index: AcPAnlH/iNPIsA5MQVCJTnNdm6aJxQ==
>Newsgroups: microsoft.public.dotnet.framework.clr
>Path: cpmsftngxa07.phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.clr:8976
>NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
>X-Tomcat-NG: microsoft.public.dotnet.framework.clr
>
>Hi all,
>
>first of all, I'm a .NET newbie, and while I have done some
>basic research and browsing, chances are that my question
>is trivial and I should simply RTFM; I apologize. Also, if
>this is not the right newsgroup, let me know.
>
>We want to add a .NET wrapper on an existing C++
>application. The way we plan to do this is to write a .NET
>DLL (let's call it wrapper.dll) which exposes some of the
>functionality in the application EXE (for this discussion,
>bigapp.exe) to .NET/COM clients. bigapp.exe is written in
>unmanaged C++ (and no, we do not want to make it managed),
>while wrapper.dll is managed C++. The wrapper DLL calls
>into the EXE using the "it just works" approach.
>
>All this "just works" fine except for one significant
>problem: It seems we need to push wrapper.dll to the GAC to
>make its services globally accessible. However, wrapper.dll
>links against bigapp.exe (direct symbol references), so
>when a client "instantiates" the DLL, the DLL needs to find
>the EXE, or it will fail to load.
>
>The trivial approach is to push bigapp.exe and everything
>associated with it to the GAC as well. However, that would
>be a HUGE package of several hundreds of megabytes in size.
>Also, since bigapp.exe is usually started as a stand-alone
>app, the more natural location for it is somewhere in the
>"Program Files" folder anyway.
>
>The only way we could make this work so far was by adding
>the installation path of bigapp.exe to the PATH environment
>variable. However, this is a hack and almost certain to
>fail on customer systems; the first system we tried this on
>already had a PATH longer than 1024 bytes, so any paths
>added to the end of PATH are simply ignored...
>
>I have seen references to modifying the assembly manager's
>probing algorithm, but AFAIK the assembly manager only
>allows to add search directories in the GAC itself, not
>outside of the GAC.
>
>Any ideas or hints most welcome. Or maybe the whole
>approach is crazy?
>
>Thanks!
>
> Claus
>
>