[IronPython] Accessing C++ managed class libraries

Todd Gruben tgruben at gmail.com
Sun Jul 6 19:40:02 CEST 2008


here is my quick and dirty class..



using namespace System;

namespace dtnnet {

    public ref class Feed
    {
        // TODO: Add your methods for this class here.
    public:

        String^ test(void)
        {
            return "Hello World";
        }
    };
}


The Reflector says that this is the full path..
C:\Documents and Settings\tgruben\My Documents\Visual Studio
2008\Projects\dtnnet\Debug\dtnnet.dll


yet here is the output of my AddReference Attempt..


C:\Documents and Settings\tgruben\My Documents\Visual Studio
2008\Projects\dtnnet\Debug>ipy
IronPython 2.0 Beta (2.0.0.3000) on .NET 2.0.50727.1433
Copyright (c) Microsoft Corporation. All rights reserved.
>>> import clr
>>> clr.AddReferenceToFileAndPath(r"C:\Documents and Settings\tgruben\My
Documents\Visual Studio 2008\Projects\dtnnet\Debug\dtnnet.dll")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: file does not exist: C:\Documents and Settings\tgruben\My
Documents\Visual Studio 2008\Projects\dtnnet\Debug\dtnnet.dll
>>>

yet i can do this ..
f = open(r""C:\Documents and Settings\tgruben\My Documents\Visual Studio
2008\Projects\dtnnet\Debug\dtnnet.dll","r").read()
and print len(f) and get 36k which is the size of the file.

I'm sure its a configuration setting... if i point the addreferrence
function to my c# library it just works.  The c# does exactly the same
thing, return a string.


Also if i just try and do AddReference("dtnnet.dll") from that directory, it
just says failed to load assembly


I'm clueless..

-Todd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20080706/7900691f/attachment.html>


More information about the Ironpython-users mailing list