pb on cast from object to customtype

E

Eric bouxirot

hi,

i'd like to do a "cast", who seem to be very complicated in .NET. in C
standard it's so easy...

i explain :
i have made an app based on plugin architecture in VB.NET. all work
fine..

but I want to avoid to the maximum to modify the interface at each new
plugin feature request from main app, i defined a function like this :

Public Function Host_GetObject(ByVal FonctionName As String,
Optional ByVal Parameters() As Object = Nothing) As Object() Implements
ENPI.Interfaces.IHost.Host_GetObject

this function get 1 parameter to tell witch "function" to do and 1
array of object (defined by the function) to optionals parameters of
this function.
this function return an array of object (content defined by the
"function" entry parameter)

i put this function in my interface between the main app and plugin. no
pb at this point.
if i use it with framework types, i get no problems.

But now, i want to return (in the array of object) a simple data
structure (no class !) like this :

Private Structure StrPIsName
Friend PIName As String
Friend PIAssyName As String
End Structure

the main app can make the array of object from array of StrPIsName.
good.
in the plugin, i get the array of object. good too.. but each object is
typed with mainapp.StrPIsName all this is normal.

but for me, for raisons i tell before, i don't want to put the
structure in the interface. (to avoid to recompil all plugin if i add
or change the structure to the interface..)

then, since my plugin does not have the reference to mainapp.StrPIsName
but to it's own StrPIsName, the cast can't be made.

do you understand what i mean ?

the end goal is to be able to make some enhancement or changes in the
main app and somme plugin or new plugins needs without the need to
recompil all other plugins.

i don't want to have many auxilliary DLL to get many interfaces between
main app and plugins too.

in fact, i want to do something (perhaps not good in .NET) like in
standard C :

toto = (mycast) tata;

HELPPP !!
 
J

Jon Skeet [C# MVP]

i don't want to have many auxilliary DLL to get many interfaces between
main app and plugins too.

You don't need to have many extra DLLs - just one which contains all
the types which need to be common between the main application and the
plugins. You can, in fact, have those types in just the executable
itself and reference that from the plugin, although that's slightly
messy in .NET 2003. What you mustn't do is have one copy of the type in
the executable and another in the plugin.
 
E

Eric bouxirot

Eric bouxirot said:
You don't need to have many extra DLLs - just one which contains all
the types which need to be common between the main application and the
plugins. You can, in fact, have those types in just the executable
itself and reference that from the plugin, although that's slightly
messy in .NET 2003. What you mustn't do is have one copy of the type in
the executable and another in the plugin.

ok, i have add the structure to the interface.... it work even if i use
an old plugin compiled with reference to older dll...
hum...i don't like this...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top