Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / CLR / January 2004

Tip: Looking for answers? Try searching our database.

GAC: Installing DLL which depends on EXE

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Claus Brod - 12 Dec 2003 10:54 GMT
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
"Shawn Farkas" - 20 Jan 2004 20:18 GMT
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

Signature

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.  
--------------------

>Content-Class: urn:content-classes:message
>From: "Claus Brod" <claus_no_brod_spam@web.de>
[quoted text clipped - 64 lines]
>
>  Claus

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.