xpnteam/xpnet

Can't run more than 1 plugin at a time

Opened this issue · 16 comments

Hi, I have created 2 separate xpnet plugins that are both working fine if it's the only xpnet type plugin added to the xplane plugins folder. The moment I have more than 1 xpnet plugin in the plugins folder then xplane will just hang when trying to load the second xpnet plugin.

The PluginAssemblyName and PluginType entries are unique for both plugins as well as the underlying dll files.
What am I doing wrong?

Thanks,
Jean

I wonder if CLR can be initialized multiple times and run side-by-side. Would you consider native AOT?

Hi, I'm not at all familiar with AOT. I was just wondering how it will work if I need to create more than one plugin. I will probably have to dust off my C++ books and just create native plugins.

Simply use https://github.com/wegylexy/XPLM for native AOT. Or would you consider combining the two into one?

Hi, is there a sample plugin using the XPLM project? I managed to get everything compiled but I'm not sure where the win.xpl is built from. Any help would be greatly appreciated.

@jfjoubert A template is available at https://github.com/wegylexy/XPLM/tree/main/XPL , which references 2 nuget packages that will generate win.xpl automatically after native AOT when you publish for win-x64.

Hi, thanks for the info.
My XPL project is complaining about the 2 nuget packages... FlyByWireless.XPLM and Microsoft.DotNet.ILCompiler. It seems as though Nuget can't find the Microsoft.DotNet.ILCompiler package.
Img001
Img002

Any ideas?

Follow https://github.com/dotnet/runtimelab/blob/feature/NativeAOT/docs/using-nativeaot/compiling.md to acquire the experimental ILCompiler.

You do not need my XPLM source code; just reference the 2 nuget packages in your own project.

Thanks for your assistance.

Feel free to create a PR to my repo with a guide for new users.

@wegylexy Hi, I'm not having any luck getting this to work. I tried with VS2019 and installed the .NET 6.0 framework. I then tried with VS2022 preview and I'm getting the same errors when trying to publish. I'm using the 'dotnet publish -r win-x64 -c Release' command.

I'm getting a whole bunch of errors:
XplTemplate.obj : error LNK2001: unresolved external symbol BCryptGenRandom
Runtime.lib(do_vxsort_avx2.cpp.obj) : error LNK2001: unresolved external symbol memset
...and a lot more like these.
And eventually, I get some error like this:
D:\Windows Kits\10\lib\10.0.20348.0\um\x86\advapi32.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'

I don't know how to reference the x64 instead of x86 libraries.

The project is building successfully though.
I'm referencing FlyByWireless.XPLM (1.0.3-alpha) and Microsoft.DotNet.ILCompiler (6.0.0-rc.1.21411.3)

Any pointers would be greatly appreciated.

You must run dotnet publish -r win-x64 -c Release in a x64 command prompt to link the correct x64 native libs, with the proper Windows SDKs and Visual C++ x64 build tools installed.

Thanks, I never even thought about that. Now it's working.

Do you perhaps have a sample of how a FlightLoop is registered? Thanks.

Thanks a million.