as my function has parameters say---- function(char **p , int*a , uint f);
This function is actually present in my unmanaged DLL,while calling the function and passing parameters while calling function from main are
say static unsafe void Main()
{
char a='s';
int b=0;
uint ulFlags=0;
function(&a, &b, 0);
}but i get error as
Error 1 :-- The best overloaded method match for 'ConsoleApplication2.Program.XRay_SearchDevices(char**, int*, uint)' has some invalid arguments.
Error 2 :-- Argument '1': cannot convert from 'char*' to 'char**'.
Loading
aasif eqbalPosted Jan 25, 2010, 6:10 AM
well please can u send me the whole code that how to call a function from an unmanged dll.
my function
EXPORT_IMPORT int __cdecl getDevices ( char ** pDeviceList, int * pDeviceCount ,unsigned long ulFlags ) this is in c++
i m working in c# and want to import dll and need to call function in my main from my unmanged dll.
please note that i have to pass parametrs while calling function in main accrding to the parameterts which i have mention in my function prototype above
so just send me the whole code to call this function.
i have code to import my dll just ahve a look on it--
[DllImport(@"C:\WINDOWS\WinSxS\unmanged.dll", SetLastError = true)]
public static unsafe extern int getDevices(char ** pDeviceList, int * pDeviceCount, uint ulFlags);
i m sucessfully able to import my dll but not able to call function i m getting error
Error 1 The best overloaded method match for 'ConsoleApplication2.getDevices() has some invalid arguments
Error 2 Argument '1': cannot convert from 'char**' to 'ref System.Text.StringBuilder'
Error 3 Argument '2': cannot convert from 'int*' to 'System.IntPtr'
when i pass these parametrts
let say getDevice(ref StringBuilder pDeviceList, IntPtr pDeviceCount, ulong ulFlags);
tell me what parametrs i have to pass from my function equivalent to this arguments while calling function in main from my unmanaged dll.
please note that i need to know what parametrs i have to pass from my function in order to call my function.
because i have several function with parametrs of different data types.
so please let me know sir abt it as soon as possible.
Sam HobbsPosted Jan 23, 2010, 1:52 PM
Since you wrote the DLL, can you modify it so that it uses something else for parameters? It might be easier to use a BSTR instead of a char **.