Using ILSPY i find out that there is BV method
available inside bvlsFortran.dll
However ILSPY says it is CALCBV!BV
to see if that is correct I added as reference in Visual Studio and then on main:
![enter image description here][3]
Assembly SampleAssembly;
SampleAssembly = Assembly.LoadFrom("bvlsFortran.dll");
// Obtain a reference to a method known to exist in assembly.
MethodInfo Method = SampleAssembly.GetTypes()[0].GetMethod("CALCBV!BV");
// Obtain a reference to the parameters collection of the MethodInfo instance.
ParameterInfo[] Params = Method.GetParameters();
// Display information about method parameters.
// Param = sParam1
// Type = System.String
// Position = 0
// Optional=False
foreach (ParameterInfo Param in Params)
{
Console.WriteLine("Param=" + Param.Name.ToString());
Console.WriteLine(" Type=" + Param.ParameterType.ToString());
Console.WriteLine(" Position=" + Param.Position.ToString());
Console.WriteLine(" Optional=" + Param.IsOptional.ToString());
}
And it is correct it displays info about it.
How can I call that method? I can not write CALCBV!BV
because compiler complains... If I write BV
or bvlsFortran
on method it does not find it.
You can call Invoke
on the Methodinfo
with an Array of the arguments you want to pass to that function.
The Name CALCBV!BV
could be an result of obfuscation, the publisher of that dll does not want you to call it directly.
Method.Invoke( args );
If it is a .Net based dll, and you any ways are referencing it in your application, why are you using reflection? Try calling the method directly instead through bvlsFortran.BV
.
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.