HighTechTalks DotNet Forums  

Accessing assemblies from an unmanaged host

Dotnet Framework (CLR) microsoft.public.dotnet.framework.clr


Discuss Accessing assemblies from an unmanaged host in the Dotnet Framework (CLR) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Anders Evensen
 
Posts: n/a

Default Accessing assemblies from an unmanaged host - 06-07-2006 , 10:38 AM






We are implementing a .NET runtime host in an unmanaged application written
in Borland Delphi. The application initializes a host, creates a new
application domain and then instantiates a class in a .NET assembly using the
new AppDomain.

Everything works fine as long as the .NET assembly to load is located
locally on the machine running the host application (the Delphi application).
If the .NET assembly is located on a network resource, the class inside the
assembly cannot be intantiated. No specific exception is thrown, but the
unwrapped object is not of the expected type. I believe this problem is
related to security in .NET. I hope that there will be someone to give me a
tip.

The code used to load the assembly looks as the following:

//Create and start a dot Net Host
Host := TJclClrHost.Create('', hfWorkStation, True, [hlOptSingleDomain]);
Host.Start;

//Create an application domain in the new host
AppDomainSetup := Host.CreateDomainSetup;
AppDomainSetup.ApplicationBase := ExtractFilePath(ADotNetAssemblyUnc);
AppDomain := Host.CreateAppDomain('myAppDomain');

//Create an instance of the dot Net class
obj := IUnknown(AppDomain.CreateInstanceFrom(
ADotNetAssemblyUnc, ADotNetClassName)) as IOBjectHandle;

//Unwrap plugin object
obj.Unwrap(UnwrappedObject);

--
Anders Evensen

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.