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.

loading assemblies without typelib

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
T Stoneman - 22 Nov 2003 21:51 GMT
Hi,

I've been investigating hosting the CLR in our app.  However, all the
examples I have found on the Net where a CLR loads an assembly, it
requires the importing of the typelib associated with the assembly.

I would prefer a more generic way, akin to LoadLibrary vs linking with
the stub .lib for a DLL.  I want to write a generic app that can load
any assembly, if it has exposed an interface that has been defined by
us.  I have searched, but since I'm a newbie, I can't seem to get
anywhere along this path.

Is there such a way?  Can someone point me in the right direction so I
can do further research?

Thanks,

Terry
Willy Denoyette [MVP] - 23 Nov 2003 14:40 GMT
The CLR doesn't need typelibs to load .NET assemblies.
Typelibs are only required by native COM clients.

Willy.

> Hi,
>
[quoted text clipped - 14 lines]
>
> Terry
T Stoneman - 24 Nov 2003 17:12 GMT
Hi Willy,

Sorry, I forgot to include several key points.

We currently have a C++ app.  I want to add to it the ability to host
a CLR, and to load a variety of different .NET assemblies that all
expose the same interface.  This C++ app should be able to scan
through a directory and load all the assemblies that have this
interface.

I have seen examples of a C++ app hosting the CLR, and loading an
assembly, but only when the C++ app imports the typelib for the
assembly.  I would like to instead load things dynamically and avoid
using a typelib because I don't know before hand what each assembly is
going to be.

Is there such a way to do what I am describing above?

Thanks,

Terry

> The CLR doesn't need typelibs to load .NET assemblies.
> Typelibs are only required by native COM clients.
[quoted text clipped - 19 lines]
> >
> > Terry
Ben Rush - 26 Nov 2003 21:54 GMT
I'm afraid I still don't understand, you are looking for typelibs for .NET
assemblies, but afaik they don't have any. All type information for an
assembly exists in its manifest and metadata.  Keep in mind I've never
written a native app to host the CLR, though.

Have a look at http://www.gotdotnet.com/team/clr/about_clr_Hosting.aspx

> Hi Willy,
>
[quoted text clipped - 41 lines]
> > >
> > > Terry
Joel Pobar [MSFT] - 28 Jan 2004 21:26 GMT
Hi,

If you're looking to load types from the unmanaged world based on what
interface they implement, you can possibly start with the unmanaged
metadata API's (IMetaDataImport, IMetaDataAssemblyImport,
IMetaDataDispenser, IMetaDataTables). There's a cool diagram in the "Common
Language Infrastructure Annotated Standard" by Jim Miller, page 324 that
shows the Metadata table layouts. You can extract a types implemented
interface from there.

Personally, I'd probably try changing whatever requirements you have to
allow Reflection to reflect and load the required types from the managed
world. Much much nicer. =)

Thanks
-Joel.

--------------------
>From: tstoneman4@hotmail.com (T Stoneman)
>Newsgroups: microsoft.public.dotnet.framework.clr
[quoted text clipped - 46 lines]
>> >
>> > Terry

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.