Import a dll dynamicly?

sitajony

Active Member
Licensed User
Hi, I'm searching about importing dll dynamicly and get his functions...
I found Assembly.LoadFrom() but I don't know how continue... There's GetNames() but I don't find help...
I know it's not really in Basic4PPC but if I find it'll be in Lib for Basic4PPC :)
With DoorEx library we can use the dll proprietes but only if it's already imported...
I do it in C#
Thanks for your help!

Edit:
Maybe I found but not sure:
B4X:
[COLOR=#008080]Assembly[/COLOR][SIZE=2] assembly = [/SIZE][SIZE=2][COLOR=#008080]Assembly[/COLOR][/SIZE][SIZE=2].LoadFrom( ASSEMBLY_NAME );
[/SIZE][SIZE=2][COLOR=#008000]         // On obtient la classe.
[/COLOR][/SIZE][SIZE=2][COLOR=#008080]         Type[/COLOR][/SIZE][SIZE=2] type = assembly.GetType( CLASS_NAME );
[/SIZE][SIZE=2][COLOR=#008000]         // On obtient la méthode.
[/COLOR][/SIZE][SIZE=2][COLOR=#008080]         MethodInfo[/COLOR][/SIZE][SIZE=2] method = type.GetMethod( METHOD_NAME );
[/SIZE][SIZE=2][COLOR=#008000]         // On créer l'objet.
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]         object[/COLOR][/SIZE][SIZE=2] target = [/SIZE][SIZE=2][COLOR=#008080]Activator[/COLOR][/SIZE][SIZE=2].CreateInstance( type );[/SIZE]
And with Door library I return "target" as object? I test...
 
Last edited:

sitajony

Active Member
Licensed User
Thanks for your replie, so I'm in the good way? Cause in fact I'll use it for use the lib who are not in the same folder that my EXE...
It's possible with the Syntax above?
 

agraham

Expert
Licensed User
Longtime User
Assembly a = Assembly.Load("whatever") // to get the Assembly

Type[] type = a.GetTypes() // gets all the Types in the Assembly

Now you have all the Types in the Assembly you can query them individually to find out what they are.

Activator.CreateInstance is limited in the Compact Framework and does not accept parameters. You can use Type.GetConstructors() to get an array of ConstructorInfos and query them individually for their parameter types. You can then use ConstructorInfo.Invoke(paramarray) to build an instance of the type.

Similarly you can get all the methods of a Type with Type.GetMethods, the Fields with GetFields and so on.

Once you have loaded an Assembly you cannot unload it. This is by design as the CLR does not know if there are instances of Types defined in the Assembly still in use so the Assembly stays loaded until the loading process exits.
 

sitajony

Active Member
Licensed User
In fact I want just use the library without know theses method/class name and I'm not sure that this code is ok:
B4X:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] objet = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]bool[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Importer([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Fichier,[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Class)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    try[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]    {[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// On Charge l'assembly.[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]        Assembly[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] a = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Assembly[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].LoadFrom(Fichier);[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]//Les classes:[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]// Type[] type = a.GetTypes();[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// On obtient la classe.[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]        Type[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] type = a.GetType(Class);[/SIZE]
[SIZE=2][COLOR=#008000][SIZE=2][COLOR=#008000]// On obtient la mthode.[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]        objet = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Activator[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].CreateInstance(type);[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]        return [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]true[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2]    }[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]catch[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Exception[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ex)[/SIZE]
[SIZE=2]    {[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]        throw [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Exception[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](ex.ToString());[/SIZE]
[SIZE=2]    }[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]public [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Methode([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] Nom, [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]String[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][] Paramettres)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][] arg = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][Paramettres.Length];[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] i = 0; i < Paramettres.Length; i++)[/SIZE]
[SIZE=2]    {[/SIZE]
[SIZE=2]        arg.SetValue(Paramettres[i], i);[/SIZE]
[SIZE=2]    }[/SIZE]
[SIZE=2]    objet.GetType().GetMethod(Nom).Invoke(objet, arg);[/SIZE]
[SIZE=2]}[/SIZE]

I didn't know what write in the last line... Is it right?
All is wrong I think...
 

agraham

Expert
Licensed User
Longtime User
The parameters need to be coerced to the correct type. This is how the Watcher object in my Debuglibrary calls a user selected method. mi is a MethodInfo, param[] is a string array of parameter values, obj is the instance on which to invoke the method and cul is a CultureInfo which is needed as the Compact Framework overload for ChangeType requires it. I have simplified the code as the original is more complex - it incorporates other checks and does cross-thread invocation - so I may have made a mistake but the core of it is there.
B4X:
                ParameterInfo[] pinfos = mi.GetParameters();
                object[] args = new object[pinfos.Length];
                if (pinfos.Length != 0)
                {
                    for (int i = 0; i < numparams; i++)
                    {
                        Type t = pinfos[i].ParameterType;
                        args[i] = Convert.ChangeType(param[i], t, cul);
                    }
                    ret = mi.Invoke(obj, args);
                }
                else
                {
                    ret = mi.Invoke(obj, null);
                }
 

sitajony

Active Member
Licensed User
I don't know what set on mi (MethodInfo) and cul (CultureInfo) I wrote this:
B4X:
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MethodInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] mi = objet.GetType().GetMethod(Nom);
[/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]CultureInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] cul = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]CultureInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2](Nom);[/SIZE]
[SIZE=2]
[/SIZE]
Is it correct?
 

sitajony

Active Member
Licensed User
mi looks OK but cul is wrong

Try

CultureInfo cul = new CultureInfo("en-US");

Ok thanks...

I've a new problem... It returns "Object refference not set to an instance..." when I want run a method...
Import:
(Fichier: dll filename)
(objet: object)
B4X:
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Assembly[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] a = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Assembly[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].LoadFrom(Fichier);[/SIZE]
[SIZE=2]objet = a.CreateInstance(Class);[/SIZE]

Run method function:
(nom: method name)
B4X:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] retour = [/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]""[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2];[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]MethodInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] mi=objet.GetType().GetMethod(Nom);[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]CultureInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] cul = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]CultureInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#a31515][SIZE=2][COLOR=#a31515]"en-US"[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]);[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]ParameterInfo[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][] pinfos = mi.GetParameters();[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][] args = [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]new [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]object[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][pinfos.Length];[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] numparams = Paramettres.Length;[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (pinfos.Length != 0)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]    for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] i = 0; i < numparams; i++)[/SIZE]
[SIZE=2]    {[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]        Type[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] t = pinfos[i].ParameterType;[/SIZE]
[SIZE=2]        args[i] = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Convert[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].ChangeType(Paramettres[i], t, cul);[/SIZE]
[SIZE=2]    }[/SIZE]
[SIZE=2]    retour = mi.Invoke(objet, args).ToString();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]{[/SIZE]
[SIZE=2]    retour = mi.Invoke(objet, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).ToString();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] retour;[/SIZE]

Where is the problem?
 

sitajony

Active Member
Licensed User
I found where were the problem:
In fact in Class name I typed: "teste" but I forget the namespace who is "fichier" so I should type "fichier.teste"... But apparently there's an other problem but I think that I'll can find...

Edit:
So it works great but when it's finish an error is returned: "Object refference not set to an instance of an object"... Weirdly there's nothing after...

B4X:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] (pinfos.Length != 0)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] ([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] i = 0; i < numparams; i++)[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Type[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] t = pinfos[i].ParameterType;[/SIZE]
[SIZE=2]args[i] = [/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]Convert[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].ChangeType(Paramettres[i], t, cul);[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]retour = mi.Invoke(objet, args).ToString();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]else[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2]{[/SIZE]
[SIZE=2]retour = mi.Invoke(objet, [/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]null[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2]).ToString();[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] retour;[/SIZE]

("retour" is as String)
And in fichier.dll:
B4X:
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] fichier[/SIZE]
[SIZE=2]{[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff] public [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]class [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]teste[/COLOR][/SIZE]
[/COLOR][/SIZE][SIZE=2] {[/SIZE]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]     public [/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] alerte([/SIZE][SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=#0000ff]string[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2] txt)[/SIZE]
[SIZE=2]     {[/SIZE]
[SIZE=2][COLOR=#2b91af][SIZE=2][COLOR=#2b91af]         MessageBox[/COLOR][/SIZE][/COLOR][/SIZE][SIZE=2].Show(txt);[/SIZE]
[SIZE=2]     }[/SIZE]
[SIZE=2] }[/SIZE]
[SIZE=2]}[/SIZE]
The error is returned after mi.Invoke()... And in B4P source I just typed:
B4X:
[SIZE=2][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]tmp()=[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Array[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"ok"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
[/SIZE][/FONT]Dll[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].New1[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b]Dll[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].Importer([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]AppPath[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]&[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"\fichier.dll"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"fichier.teste"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]Msgbox[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b][FONT=Courier New][SIZE=2][COLOR=#008b8b]Dll[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2].Methode([/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"alerte"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2],tmp()))[/SIZE][/FONT][/SIZE][/FONT]
[/SIZE]
I don't understand... I try to type try{} catch{} for see exactly where is the problem, it's on my C# source or B4P...

Edit:
I found: in fact teste() doesn't return any value...

Edit:
Finally it's done (nearly) so for check the type of data returned I use
mi.ReturnType.ToString();
It return "System.Void" if it doens't return any value and when it's a System.Void I return "" but maybe there's a better way...
Edit: I check if the returned value is null or not and it's ok...
I would like to say "thanks very much" :) Without you I'll be still with "Assembly.LoadFrom()" ;)
 
Last edited:
Top