3

Does anyone know how to add python and ruby libs as a resource in a dll for deployment? I want to host a script engine in my app, but dont want to have to deploy the entire standard libraries of the respective languages in source files. Is there a simple way to do this so that a require or import statement will find the embedded resources?

3 Answers 3

1

You could add custom import hook that looks for embedded resources when an import is executed. This is slightly complex and probably not worth the trouble.

A better technique would be to fetch all of the embedded modules at startup time, execute them with the ScriptEngine and put the modules you have created into the sys.modules dictionary associated with the engine. This automatically makes them available for import by Python code executed by the engine.

0

You can create StreamContentProviders for example

In the ironrubymvc project under IronRubyMVC/Core/ you will find what you need.

AssemblyStreamContentProvider

Usage of the ContentProvider

0

IronPython 2.0 has a sample compiler called PYC on Codeplex.com/ironpython which can create DLL's (and applications if you need them too).

IronPython 2.6 has a newer version of PYC under Tools\script.

Cheers, Davy

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.