Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run more than 1 plugin at a time #33

Open
jfjoubert opened this issue Jun 2, 2021 · 16 comments
Open

Can't run more than 1 plugin at a time #33

jfjoubert opened this issue Jun 2, 2021 · 16 comments

Comments

@jfjoubert
Copy link

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

@wegylexy
Copy link

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

@jfjoubert
Copy link
Author

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.

@wegylexy
Copy link

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

@jfjoubert
Copy link
Author

jfjoubert commented Aug 10, 2021 via email

@jfjoubert
Copy link
Author

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.

@wegylexy
Copy link

@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.

@jfjoubert
Copy link
Author

jfjoubert commented Aug 10, 2021

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?

@wegylexy
Copy link

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.

@jfjoubert
Copy link
Author

Thanks for your assistance.

@wegylexy
Copy link

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

@jfjoubert
Copy link
Author

@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.

@wegylexy
Copy link

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.

@jfjoubert
Copy link
Author

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

@jfjoubert
Copy link
Author

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

@wegylexy
Copy link

Added just now wegylexy/XPLM@b9a8ed8

@jfjoubert
Copy link
Author

Thanks a million.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants