Set DllImport attribute dynamically

后端 未结 2 784
死守一世寂寞
死守一世寂寞 2020-11-29 09:46

I am making use of an external unmanaged dll using PInvoke and the DllImport attribute. eg.

[DllImport(\"mcs_apiD.dll\", CharSet = CharSet.Auto)]
private s         


        
2条回答
  •  醉话见心
    2020-11-29 10:30

    you can't change the name of the dll but you can alter the path of the library being loaded (like by reading it from the registry or a configuration file) and load it manually with LoadLibrary kernel32's function: see my answer there.

提交回复
热议问题