<div dir="auto"><div>The .NET Core version of IronPython does not support assembly generation. I haven't tried it myself, but you could probably compile the assembly using the full framework version and then run it with .NET Core 2.0 (assuming you're not using unsupported APIs).</div><div dir="auto"><div dir="auto"><br></div><div dir="auto">Stéphane</div><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Tue, Apr 3, 2018, 5:16 PM Josiah Kiehl, <<a href="mailto:jkiehl@riotgames.com">jkiehl@riotgames.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Oh, I'm on dotnet 2.0.3, if that's relevant information.</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 3, 2018 at 2:15 PM Josiah Kiehl <<a href="mailto:jkiehl@riotgames.com" target="_blank" rel="noreferrer">jkiehl@riotgames.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm trying to execute this example code:<div><a href="https://stackoverflow.com/questions/32639893/call-dll-function-from-c-sharp-ironpython" target="_blank" rel="noreferrer">https://stackoverflow.com/questions/32639893/call-dll-function-from-c-sharp-ironpython</a><br></div><div><br></div><div>I realize the posted question is a few years old at this point... has something changed in how python, compiled to a DLL via clr.CompileModule, is loaded?</div><div><br></div><div>I'm getting this error when I run the code in the example at the above link:</div><div><div>Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.Closure' from assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.</div><div>   at DLRCachedCode.test$1(CodeContext $globalContext, FunctionCode $functionCode)</div><div>   at IronPython.Compiler.OnDiskScriptCode.Run()</div></div><div><br></div><div>(full stack: <a href="https://gist.github.com/capoferro/5a730088582b8cd36591be510d6ca2fc" target="_blank" rel="noreferrer">https://gist.github.com/capoferro/5a730088582b8cd36591be510d6ca2fc</a>)</div><div><br></div><div>My ipy.exe, which did the compilation, is 2.7.8.0 and my embedded IronPython is 2.7.8.1, though I get the same error on 2.7.8.0.</div><div><br></div><div>Am I missing something obvious or is there a better example to use?</div><div><br></div><div>My end goal is to be able to take a python module defined in a file (foo.py) with some functions defined, compile it into a dll via CompileModule, then load it directly from the dll via ImportModule to skip the performance hit of interpreting the Python at runtime.</div><div><br></div><div>Thanks!</div></div><div dir="ltr"><div>Josiah</div><div><br></div><div><br></div></div></blockquote></div>
_______________________________________________<br>
Ironpython-users mailing list<br>
<a href="mailto:Ironpython-users@python.org" target="_blank" rel="noreferrer">Ironpython-users@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/ironpython-users" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/ironpython-users</a><br>
</blockquote></div></div></div>