Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
3.67/5 (3 votes)
See more:
Hello, I have this method at c#.
Which is the right way to call it?


C#
[System.Runtime.InteropServices.DllImportAttribute("QCamDriver.dll",CallingConvention=CallingConvention.StdCall,EntryPoint = "QCam_ListCameras")]
            public static extern QCam_Err QCam_ListCameras(ref QCam_CamListItem pList, ref uint pNumberInList);
Posted
Comments
ZurdoDev 18-Mar-13 8:58am    
Have you tested it? Does it work?
GustavoUgioni 18-Mar-13 9:02am    
I have not tested yet, but just because I don't know how to call it on a proper way.
CHill60 18-Mar-13 9:09am    
For infomation - If you use the Reply link next to someone's comment it will automatically let them know that you have responded. It doesn't do this if you just add another comment to your own question
GustavoUgioni 18-Mar-13 9:19am    
Right, thanks.
[no name] 18-Mar-13 9:17am    
If you have not tested it, how do you know that it does not work?

1 solution

if you are calling the managed code then

 Assembly SampleAssembly = Assembly.LoadFrom(filename);
Type myType = SampleAssembly.GetTypes()[0];
MethodInfo Method = myType.GetMethod("myVoid");
object myInstance = Activator.CreateInstance(myType);
Method.Invoke(myInstance, null); 


and if you are calling unmanaged code then

Calling methods from Dll compiled in 'C' from C#[^]
 
Share this answer
 
Comments
[no name] 18-Mar-13 10:51am    
+5
Menon Santosh 19-Mar-13 0:49am    
Thanks :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900