Calling Methods in a DLL from Python

In my script I’d like to make certain functionality inaccessible to some users. So I was thinking I’d create a DLL which I distribute (or don’t depending on the user). Then I check for the presence of the DLL and if it’s available I call methods in it. If the DLL is not there I put up a message box and say “sorry… only available to blah, blah, blah”.

So I’d like to create a DLL that exposes a method which I can call from python. I can create the DLL using Visual Studio and C#. I’m wondering if anyone can share an example of doing this. That is the loading and calling sequence from python. And the basic code structure in C#.

If anyone has an example or any helpful suggestions I’d appreciate it!

Thanks,
Mark

I think you’re looking for crl.AddReference

In the past, I’ve used this to import from the Grasshopper SDK

Here’s some related threads on StackOverflow

calling C# methods from IronPython
Using IronPython classes in C#

I hope this clarifies the issue for you.

Thanks very much, there’s some great info in those links :smile:

Mark