[Mono-list] Casting and Plugin Issue

Pablo Fischer pablo@pablo.com.mx
Sun, 27 Jun 2004 22:06:01 -0500


--=-bYbpElFTfPeRIrPlaEmH
Content-Type: text/plain; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable

Oh yes, what an idiot, I forgot that.

Thanks!
Pablo
El dom, 27-06-2004 a las 22:02, Chris Turchin escribi=F3:
> hi  pablo,
>=20
> i am no  expert, but i think  you need to rerference the  assembly contai=
ning
> which should perhaps not be in the  same assembly as said  plugin itself.
>=20
> --chris
>=20
> On Sun, 27 Jun 2004, Pablo Fischer wrote:
>=20
> > Hi!
> >
> > > I don't have any other idea, but I thought that maybe instead of doin=
g:
> > >
> > > <snip>
> > > my_method =3D t.GetMethod("MGetPosts");
> > > object retVal =3D my_method.Invoke(activator,
> > >                                 BindingFlags.Instance |
> > > 				BindingFlags.NonPublic |
> > > 				BindingFlags.InvokeMethod,
> > >                                 null,
> > >                                 new Object[]{3, user},
> > >                                 null);
> > > </snip>
> > >
> > > You could do:
> > >
> > > 	IPluging p =3D (IPlugin)t;
> > > 	object retVal =3D p.MGetPosts(3, user);
> >
> > Sounds great, I tried what you said with two assemblies: one is the
> > Structs.dll (*Struct.cs) and the other Plugin.dll (Plugin.cs and the
> > interface IPlugin.cs), then I compiled MyApp with
> >
> > mcs MyApp.cs -r Structs.dll
> >
> > And then tried to cast it, and it fails:
> >
> > Test7.cs(20) error CS0246: Cannot find type `IPlugin'
> >
> > Also I did a Console.WriteLine to 't' (Type) and prints
> > MBloggy.Plugins.IPlugin.
> >
> > Seems that I can't cast an interface, or what I'm doing wrong?.
> >
> >  Assembly a;
> >  Type t;
> >  MethodInfo my_method;
> >
> >  a =3D Assembly.LoadFrom("BloggerPlugin.dll");
> >  t =3D a.GetType("MBloggy.Plugins.IPlugin");
> >  Console.WriteLine(t);
> >
> > As I said, I'm testing what you suggested, but with Reflections the
> > plugins are working great!
> >
> > Thanks
> > Pablo
> > --
> > Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
> > Fingerprint:  5973 0F10 543F 54AE 1E41  EC81 0840 A10A 74A4 E5C0
> > http://www.pablo.com.mx
> > http://www.debianmexico.org
> >
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
--=20
Pablo Fischer Sandoval (pablo [arroba/at] pablo.com.mx)
Fingerprint:  5973 0F10 543F 54AE 1E41  EC81 0840 A10A 74A4 E5C0
http://www.pablo.com.mx=20
http://www.debianmexico.org

--=-bYbpElFTfPeRIrPlaEmH
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBA34sZCEChCnSk5cARAvqxAJ0fuLqFKTbDyKpnkjNlpzs1dJtpggCeOVNY
q0JTsf9ArTIQiIT49si6+rE=
=sqD/
-----END PGP SIGNATURE-----

--=-bYbpElFTfPeRIrPlaEmH--