[IronPython] Adding a namespace to a python dll

Dino Viehland dinov at exchange.microsoft.com
Tue Apr 11 17:58:21 CEST 2006

Currently there's no way that you can do this.  This comes back to the old static compilation problem which we don't yet support (we're a CLS consumer currently, not a CLS producer).

If you'd like to interop w/ C# code the best way to do this today would be via interfaces or inheritance from classes defined in C#, and then have the Python code call into the C# code to give C# code objects.  Alternately you can use the hosting APIs to create Python objects from C#.

This is something that we'd like to provide in the future, but the odds are currently in the favor of this shipping in v1.1 rather than v1.0.

Do you want to help develop Dynamic languages on CLR? (http://members.microsoft.com/careers/search/details.aspx?JobID=6D4754DE-11F0-45DF-8B78-DC1B43134038)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Anthony Tarlano
Sent: Tuesday, April 11, 2006 8:53 AM
To: Discussion of IronPython
Subject: [IronPython] Adding a namespace to a python dll


The question is whether anyone can tell me how to add a namespace to a
PE file that was created from a python file using the PythonCompiler?

I used the PythonCompiler from IronPython.Hosting to create a DLL
assembly, but after adding a reference to the file and attempting to
use the using namespace directive from C# to access the classes of the
DLL all I get is an error

Hosting.cs(3,7): error CS0138: A using namespace directive can only be applied
        to namespaces; 'service' is a type not a namespace

I used the .NET reflector to inspect the PE and sure enough there
doesn't seem to be a namespace or more specifically it seems to be a
zero length string.


users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list