Load module failed(SDKERR_MODULE_LOAD_FAILED) in C#


#1

When I call sdk in C#, I got SDKERR_MODULE_LOAD_FAILED, here is the code, could me please help me resolve this as soon as possible, thanks a lot:

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct InitParam
{
public string strWebDomain;///< Web Domain
public string strBrandingName;///< Branding name
public string strSupportUrl;///< Support Url
public IntPtr hResInstance;///< resource moudle handle
public UInt32 uiWindowIconSmallID;///< windows small icon file path
public UInt32 uiWindowIconBigID;///< windows small icon file path
public SDK_LANGUAGE_ID emLanguageID;///< sdk language ID
};

static class Program
{
[DllImport(@“c:\users\rex\documents\visual studio 2015\Projects\WindowsFormsApplication1\WindowsFormsApplication1\zoom\bin\sdk.dll”, EntryPoint = “InitSDK”, CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
public static extern SDKError InitSDK(ref InitParam initParam);

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
InitParam param = new InitParam();
param.strWebDomain = “https://zoom.us”;
SDKError error = InitSDK(ref param);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}


#2

two options to fix this issue.

1.put the sdk dlls into the same folder with exe file.

2.import kernel32 method SetDllDirectory, and config the sdk dlls path

[DllImport(“kernel32.dll”, CharSet = CharSet.Unicode, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
public static extern bool SetDllDirectory(string lpPathName);

SetDllDirectory(sdk dlls folder path);

//after that, init sdk.

 


#3

Using the option 1,  the issue is fixed. Thank you very much for your quick and useful solution.