Skip to content

Loader #1322

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

Closed
wants to merge 8 commits into from
Closed

Loader #1322

wants to merge 8 commits into from

Conversation

filmor
Copy link
Member

@filmor filmor commented Dec 13, 2020

What does this implement/fix? Explain your changes.

Integrates clr-loader.

Does this close any currently open issues?

Continues #857, last stepping stone for #984.

Any other comments?

...

Checklist

Check all those that are applicable and complete.

  • Make sure to include one or more tests for your change
  • If an enhancement PR, please create docs and at best an example
  • Add yourself to AUTHORS
  • Updated the CHANGELOG

@filmor
Copy link
Member Author

filmor commented Dec 13, 2020

@lostmsu This approach (Python.Loader.dll explicitly modifies and adjusts Python.Runtime.dll) works nicely for embedding into Python, but I can't get it to work in the other direction right now (embedding Python in C#), as the Python.Runtime seems to be eagerly loaded. Do you still have your branch were you stubbed out the Python functions into an interface? We can discuss this a bit more on Thursday.

Recap: The main reason we have to do something like this is that __Internal as the DLL name for P/Invoke only works on Mono (allows us to preload the DLL using the respective dynamic linkers, for which we already have a working implementation), and it's possible to do something similar for .NET Core, but definitely not for .NET Framework.

@filmor
Copy link
Member Author

filmor commented Dec 13, 2020

#987 is relevant.

@lostmsu
Copy link
Member

lostmsu commented Dec 13, 2020

@filmor I am actually working on #987. It is currently blocked on the release of dotnet/roslyn#49760 . From the looks of it, will be released with the next VS 2019 16.9.x preview hopefully in a couple of weeks (maybe early Jan because of holidays).

Expect to be able to set Runtime.PythonDLL before calling PythonEngine.Initialize(...) or maybe have an Initialize overload, that takes DLL path.

@lostmsu
Copy link
Member

lostmsu commented Dec 13, 2020

Oh, forgot to mention. I expect the default value for Runtime.PythonDLL to be null, and behave identical to __Internal, so loader should not need to change it.

@filmor
Copy link
Member Author

filmor commented Dec 13, 2020

On all runtimes?

@lostmsu
Copy link
Member

lostmsu commented Dec 13, 2020

Yes. However, I think we need to have TypeOffset code on Python side. E.g. clr module should pass a dict describing TypeOffset to Python.Runtime during initialization. That way we can have single Python.Runtime handle any version of Python.

@filmor
Copy link
Member Author

filmor commented Dec 13, 2020

I'll have a look into this. Worst case, we just run our pycparser once on first start and generate and cache the data in an easily readable format.

@filmor filmor closed this Jan 29, 2021
@filmor filmor deleted the loader branch January 29, 2021 06:54
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

Successfully merging this pull request may close these issues.

2 participants