Wayne Werner
Wayne Werner

Reputation: 51897

How to set a namespace for an IronPython imported dll?

I've got a .NET dll that I'm importing, and it seems to work fine, except when it runs inside a VB or .NET program it takes a look at the namespace that it's running in to determine if the namespace is authorized to use that particular functionality.

So for instance, if I were writing an app in C# it might look something like this:

using The.New.Library;

namespace Knights.Of.The.Round.Table {
     public class Knight{
          // Some code
          private void fight(){
              The.New.Library.DoSomething();
          }
     }
}

And it would work fine, because the namespace Knights.* is authorized to use DoSomething

Is it possible to tell the dll when I import it in IronPython that the namespace is actually Knights.*, rather than whatever it really is - or even if I could just use a correct folder structure so it found the "correct" namespace, that might also work.

Thanks!

Upvotes: 0

Views: 258

Answers (1)

Jeff Hardy
Jeff Hardy

Reputation: 7662

I think your only option is to make a C# wrapper that's in the proper namespace and just forwards to the library.

Also, that might be the most bizarre "security" scheme I've ever heard of, especially given how easy it would be to "defeat". Whoever designed that should never be allowed near a computer again.

Upvotes: 2

Related Questions