.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> .NET Framework >> Post New QuestionBookmark and Share Subscribe to Forum

Loading unmanaged DLL at runtime

Posted By: yeap     Posted Date: March 30, 2011    Points:5   Category :.NET Framework
Hi
I need to dynamically load unmanaged dlls , located at a known path.
How do I do that in my C# program when I dont have in advance the functions names and parameters.
I was told to create a plugin(?) , and it is possible for me to get an xml file which consists of every dll name ,functions name and parameters names and number.
Does it seems to be the right way to handle this? how do I load those unmanaged DLLs ?
thank you

Responses
Author: Mahesh             
Posted Date: March 30, 2011     Points: 20   

hi,
you can follow the link below which may help you,

you can read xml as,
http://www.codeproject.com/KB/cpp/parsefilecode.aspx

and pass the dll names to this,

http://blogs.msdn.com/b/jonathanswift/archive/2006/10/03/dynamically-calling-an-unmanaged-dll-from-.net-_2800_c_23002900_.aspx

Thanks & Regards
Mahesh

Author: yeap             
Posted Date: March 30, 2011     Points: 20   

hi
thank u
the problem with the exanple is that the delegate "knows" the DLL function name in advanced
I get the method name at runtime
It is ok if the signature if fixed int function_name(byte[]param)
the dynamic names are the problem

Author: yeap             
Posted Date: March 31, 2011     Points: 20   

hi
thank u
the problem with the exanple is that the delegate "knows" the DLL function name in advanced
I get the method name at runtime
It is ok if the signature if fixed int function_name(byte[]param)
the dynamic names are the problem

Author: Mahesh             
Posted Date: March 31, 2011     Points: 20   

Hi,
for the dynamic method names you need to use the reflection for it,

System.Reflection.MethodBase.GetCurrentMethod() 'with this you can get the method name and

System.Reflection.MethodBase.GetCurrentMethod().GetParameters() 'with this you can get the parameter names for that method

for details you can refer link,
http://www.csharp-examples.net/get-method-names/
http://geekswithblogs.net/opiesblog/archive/2006/06/29/83654.aspx

Thanks & Regards
Mahesh


Author: yeap             
Posted Date: March 31, 2011     Points: 20   

the DLLs I need to load are unmanaged .



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend