开发者

how to use classes written in IronPython in VB.NET

I have a class (e.g. MksMath) written in IronPython using SharpDevelop 3.2. After compiling it for class library, it produced the following output:

IronPython.dll

IronPython.Modules.dll

Microsoft.Dynamic.dll

Microsoft.Scripting.Core.dll

Microsoft.Scripting.Debugging.dll

Microsoft.Scripting.dll

Microsoft.Scripting.ExtensionAttribute.dll

mksmath.dll

If I try to add reference to all above dll and import "MksMath", I am unable to access it. The vbc is throwing the following error开发者_开发技巧:

Namespace or type specified in the Imports 'MksMath' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

I am new to IronPython. Kindly advise how to use this class in my vb.net code?


I post here my answer that I posted to IronPythopn mailing list :-)

You cannot use mksmath.dll directly from VB (see Compiling Python code into an assembly) so you have to host IronPython engine in your VB app and use mksmath.dll from the engine. See Using Compiled Python Classes from .NET/CSharp IP 2.6 for example (in C#).


Here is a link that I think may solve the issue. http://msmvps.com/blogs/theproblemsolver/archive/2008/08/14/calling-ironpython-functions-from-net.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜