3F / DllExport

.NET DllExport with .NET Core support (aka 3F/DllExport aka DllExport.bat)
MIT License
938 stars 131 forks source link

Question in case of using DllExport #165

Closed ghost closed 4 years ago

ghost commented 4 years ago

Create a module for OBStudio , obs can load with OurILAsm+SysObjRebase setting dll But when I create new thread or try catch , the obs will throw exception in call obs_module_load

obs

[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern int MessageBox(int hWnd, String text, String caption, uint type);

[DllExport(ExportName = "obs_module_load")]
public static bool Load()
{
   MessageBox(0, "Load", "obs_module_load", 0);
   //Task.Factory.StartNew(() =>{});
   //try { MessageBox(0, "Load", "obs_module_load", 0); } catch(Exception ex) { Debug.WriteLine(ex.Message); }
   return true;
}

Repo: obstest
Module_Doc For testing: after build and installed obs , put the dll into obs-studio\obs-plugins\64bit\obstest.dll

3F commented 4 years ago

Since your target is Preview .NET 5, it could be a duplicate of #132. Please follow instructions there.

Let me know the result for .NET Standard 2.0 or .NET Core 2.2

ghost commented 4 years ago

Thanks, the test results shown below.

X64 + OurILAsm + SysObjRebase

Target Framework TFM
.NET Standard
✔️1.1
✔️1.2
✔️1.3
✔️1.4
✔️1.5
✔️1.6
✔️2.0
2.1
.NET Core
1.0
1.1
2.0
2.1
2.2
3.0
3.1
3F commented 4 years ago

Thanks for the information. I've checked the issue. This is duplicate of #132 but OBS case looks more problematic because, for example, "netcoreapp2.2 seems pretty fine"

Temporarily please use netstandard targeting in your case.