简体   繁体   中英

Clr dll .net control

I need to dynamic loading some .NET control from DLL in runtime from C# winforms host project.

for example:

1.dll contrains control1

2.dll contrains control2

3.dll contrains control3

host app may load any of this dll-s, get controls from dll and put it on self form.

I tried:

__declspec(dllexport) TestCLRPlugin::Properties ^ GetControl()
{
    return gcnew TestCLRPlugin::Properties();
}

but, clrcall methods can't be exported from dll.

You need to use the Assembly.LoadFrom methods and then you can use reflection to get the method/class/etc you want from the assembly. There are pretty good examples if you follow the MSDN link.

I'm not sure quite what you're looking for, but you may want to read up on reflection, which makes this pretty easy:

http://msdn.microsoft.com/en-us/library/ms173183(v=vs.80).aspx

Sorry if you're already familiar or that doesn't help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM