-
[C#] DllImportC#/기초 2024. 7. 23. 08:33
SetDllDirectory
string dllPath = Path.Combine(Directory.GetCurrentDirectory() , "dllImport"); [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] static extern bool SetDllDirectory(string lpPathName); public ManagerClientExportTest() { var isSet = SetDllDirectory(dllPath); }
https://stackoverflow.com/questions/8836093/how-can-i-specify-a-dllimport-path-at-runtime
How can I specify a [DllImport] path at runtime?
In fact, I got a C++ (working) DLL that I want to import into my C# project to call it's functions. It does work when I specify the full path to the DLL, like this : string str = "C:\\Users\\user...
stackoverflow.com
728x90'C# > 기초' 카테고리의 다른 글
[C#] Nuget publish (0) 2024.07.31 [C#] regsvr32 레지스트리 DLL 등록 (0) 2024.07.23 [C#] nuget.Config (0) 2024.07.19 [C#] gRPC Unit Test (0) 2024.07.04 [C#] Delay, sleep, wait (0) 2024.06.14 댓글