Re: [IronPython] Calling a System DLL In IronPython?

2010-01-25 Thread Shri Borde
Good idea (for all other samples too). Will look into it.

-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord
Sent: Monday, January 25, 2010 2:00 PM
To: Discussion of IronPython
Subject: Re: [IronPython] Calling a System DLL In IronPython?

On 25/01/2010 21:23, Shri Borde wrote:
> Its in Samples.zip on 
> http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=12482. 
> There have been a few bug fixes since that are not in Samples.zip, but it 
> does not affect pinvoke.
>
>

Great - thanks. For what it's worth it is worth running a tool like 
pyflakes over clrtype.py. I'm using a version that is possibly slightly 
outdated in a Silverlight project and pyflakes gives several warnings on 
clrtype.py (including a warning about an incorrectly constructed assert):

modules/clrtype.py:21: 'Char' imported but unused
modules/clrtype.py:21: 'Boolean' imported but unused
modules/clrtype.py:27: 'NameType' imported but unused
modules/clrtype.py:28: 'ReflectedProperty' imported but unused
modules/clrtype.py:182: local variable 'p' is assigned to but never used
modules/clrtype.py:354: local variable 'p' is assigned to but never used

(I have already fixed the assert manually I believe.)

All the best,

Michael
> -Original Message-
> From: users-boun...@lists.ironpython.com 
> [mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord
> Sent: Sunday, January 24, 2010 4:19 AM
> To: Discussion of IronPython
> Cc: users@lists.ironpython.com
> Subject: Re: [IronPython] Calling a System DLL In IronPython?
>
> For ctypes you should use the documentation that is part of the Python
> documentation. For PInvoke the references will be mainly for C#.
>
> Does anyone have examples of using PInvoke with clrtype and IronPython
> 2.6?
>
> Michael
>
>
> --
> http://www.ironpythoninaction.com
>
> On 24 Jan 2010, at 03:24, David McWright
> wrote:
>
>
>> Is there a reference somewhere for PInvoke or ctypes in IP?
>>
>> TIA,
>> David
>>
>> On Jan 23, 7:31 pm, Michael Foord  wrote:
>>  
>>> On 24/01/2010 00:19, Andrew Evans wrote:
>>>
>>>
>>>> I am trying to call user32.dll into IronPython how do I do this?
>>>> Do I
>>>> use clr.AddReference, that doesn't seem to do it.
>>>>  
>>> clr.AddReference only works for .NET assemblies. user32.dll is not a
>>> .NET assembly. To use it you will either need PInvoke or ctypes that
>>> comes with IronPython 2.6.
>>>
>>> PInvoke relies on .NET attributes. It used to be the case that you
>>> couldn't use these directly with IronPython but needed a simple C#
>>> wrapper. The following article shows how to call into user32.dll
>>> using a
>>> C# wrapper:
>>>
>>>   http://www.voidspace.org.uk/ironpython/winforms/part10.shtml
>>>
>>> Alternatively you can try clrtype.py that comes with IronPython 2.6.
>>>
>>> All the best,
>>>
>>> Michael Foord
>>>
>>>
>>>
>>>
>>>> Suggestions
>>>>  
>>>
>>>> ___
>>>> Users mailing list
>>>> us...@lists.ironpython.com
>>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>>>  
>>> --http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog
>>>
>>> READ CAREFULLY. By accepting and reading this email you agree, on
>>> behalf of your employer, to release me from all obligations and
>>> waivers arising from any and all NON-NEGOTIATED agreements,
>>> licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
>>> confidentiality, non-disclosure, non-compete and acceptable use
>>> policies ("BOGUS AGREEMENTS") that I have entered into with your
>>> employer, its partners, licensors, agents and assigns, in
>>> perpetuity, without prejudice to my ongoing rights and privileges.
>>> You further represent that you have the authority to release me
>>> from any BOGUS AGREEMENTS on behalf of your employer.
>>>
>>> ___
>>> Users mailing list
>>> us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/
>>> users-ironpython.com
>>>
>> ___
>> Users mailing list
>> Users@lists.ironpython.c

Re: [IronPython] Calling a System DLL In IronPython?

2010-01-25 Thread Michael Foord

On 25/01/2010 21:23, Shri Borde wrote:

Its in Samples.zip on 
http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=12482. 
There have been a few bug fixes since that are not in Samples.zip, but it does 
not affect pinvoke.

   


Great - thanks. For what it's worth it is worth running a tool like 
pyflakes over clrtype.py. I'm using a version that is possibly slightly 
outdated in a Silverlight project and pyflakes gives several warnings on 
clrtype.py (including a warning about an incorrectly constructed assert):


modules/clrtype.py:21: 'Char' imported but unused
modules/clrtype.py:21: 'Boolean' imported but unused
modules/clrtype.py:27: 'NameType' imported but unused
modules/clrtype.py:28: 'ReflectedProperty' imported but unused
modules/clrtype.py:182: local variable 'p' is assigned to but never used
modules/clrtype.py:354: local variable 'p' is assigned to but never used

(I have already fixed the assert manually I believe.)

All the best,

Michael

-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord
Sent: Sunday, January 24, 2010 4:19 AM
To: Discussion of IronPython
Cc: users@lists.ironpython.com
Subject: Re: [IronPython] Calling a System DLL In IronPython?

For ctypes you should use the documentation that is part of the Python
documentation. For PInvoke the references will be mainly for C#.

Does anyone have examples of using PInvoke with clrtype and IronPython
2.6?

Michael


--
http://www.ironpythoninaction.com

On 24 Jan 2010, at 03:24, David McWright
wrote:

   

Is there a reference somewhere for PInvoke or ctypes in IP?

TIA,
David

On Jan 23, 7:31 pm, Michael Foord  wrote:
 

On 24/01/2010 00:19, Andrew Evans wrote:

   

I am trying to call user32.dll into IronPython how do I do this?
Do I
use clr.AddReference, that doesn't seem to do it.
 

clr.AddReference only works for .NET assemblies. user32.dll is not a
.NET assembly. To use it you will either need PInvoke or ctypes that
comes with IronPython 2.6.

PInvoke relies on .NET attributes. It used to be the case that you
couldn't use these directly with IronPython but needed a simple C#
wrapper. The following article shows how to call into user32.dll
using a
C# wrapper:

  http://www.voidspace.org.uk/ironpython/winforms/part10.shtml

Alternatively you can try clrtype.py that comes with IronPython 2.6.

All the best,

Michael Foord



   

Suggestions
 
   

___
Users mailing list
us...@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 

--http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on
behalf of your employer, to release me from all obligations and
waivers arising from any and all NON-NEGOTIATED agreements,
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,
confidentiality, non-disclosure, non-compete and acceptable use
policies ("BOGUS AGREEMENTS") that I have entered into with your
employer, its partners, licensors, agents and assigns, in
perpetuity, without prejudice to my ongoing rights and privileges.
You further represent that you have the authority to release me
from any BOGUS AGREEMENTS on behalf of your employer.

___
Users mailing list
us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/
users-ironpython.com
   

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
 

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
   



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
your employer, to release me from all obligations and waivers arising from any 
and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, 
clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and 
acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your 
employer, its partners, licensors, agents and assigns, in perpetuity, without 
prejudice to my ongoing rights and privileges. You further represent that you 
have the authority to release me from any BOGUS AGREEMENTS on behalf of your 
employer.


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Calling a System DLL In IronPython?

2010-01-25 Thread Shri Borde
Its in Samples.zip on 
http://ironpython.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=12482. 
There have been a few bug fixes since that are not in Samples.zip, but it does 
not affect pinvoke.

-Original Message-
From: users-boun...@lists.ironpython.com 
[mailto:users-boun...@lists.ironpython.com] On Behalf Of Michael Foord
Sent: Sunday, January 24, 2010 4:19 AM
To: Discussion of IronPython
Cc: users@lists.ironpython.com
Subject: Re: [IronPython] Calling a System DLL In IronPython?

For ctypes you should use the documentation that is part of the Python  
documentation. For PInvoke the references will be mainly for C#.

Does anyone have examples of using PInvoke with clrtype and IronPython  
2.6?

Michael


--
http://www.ironpythoninaction.com

On 24 Jan 2010, at 03:24, David McWright   
wrote:

> Is there a reference somewhere for PInvoke or ctypes in IP?
>
> TIA,
> David
>
> On Jan 23, 7:31 pm, Michael Foord  wrote:
>> On 24/01/2010 00:19, Andrew Evans wrote:
>>
>>> I am trying to call user32.dll into IronPython how do I do this?  
>>> Do I
>>> use clr.AddReference, that doesn't seem to do it.
>>
>> clr.AddReference only works for .NET assemblies. user32.dll is not a
>> .NET assembly. To use it you will either need PInvoke or ctypes that
>> comes with IronPython 2.6.
>>
>> PInvoke relies on .NET attributes. It used to be the case that you
>> couldn't use these directly with IronPython but needed a simple C#
>> wrapper. The following article shows how to call into user32.dll  
>> using a
>> C# wrapper:
>>
>>  http://www.voidspace.org.uk/ironpython/winforms/part10.shtml
>>
>> Alternatively you can try clrtype.py that comes with IronPython 2.6.
>>
>> All the best,
>>
>> Michael Foord
>>
>>
>>
>>> Suggestions
>>
>>> ___
>>> Users mailing list
>>> us...@lists.ironpython.com
>>> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>>
>> --http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog
>>
>> READ CAREFULLY. By accepting and reading this email you agree, on  
>> behalf of your employer, to release me from all obligations and  
>> waivers arising from any and all NON-NEGOTIATED agreements,  
>> licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,  
>> confidentiality, non-disclosure, non-compete and acceptable use  
>> policies ("BOGUS AGREEMENTS") that I have entered into with your  
>> employer, its partners, licensors, agents and assigns, in  
>> perpetuity, without prejudice to my ongoing rights and privileges.  
>> You further represent that you have the authority to release me  
>> from any BOGUS AGREEMENTS on behalf of your employer.
>>
>> ___
>> Users mailing list
>> us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/ 
>> users-ironpython.com
> ___
> Users mailing list
> Users@lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Calling a System DLL In IronPython?

2010-01-24 Thread Michael Foord
For ctypes you should use the documentation that is part of the Python  
documentation. For PInvoke the references will be mainly for C#.


Does anyone have examples of using PInvoke with clrtype and IronPython  
2.6?


Michael


--
http://www.ironpythoninaction.com

On 24 Jan 2010, at 03:24, David McWright   
wrote:



Is there a reference somewhere for PInvoke or ctypes in IP?

TIA,
David

On Jan 23, 7:31 pm, Michael Foord  wrote:

On 24/01/2010 00:19, Andrew Evans wrote:

I am trying to call user32.dll into IronPython how do I do this?  
Do I

use clr.AddReference, that doesn't seem to do it.


clr.AddReference only works for .NET assemblies. user32.dll is not a
.NET assembly. To use it you will either need PInvoke or ctypes that
comes with IronPython 2.6.

PInvoke relies on .NET attributes. It used to be the case that you
couldn't use these directly with IronPython but needed a simple C#
wrapper. The following article shows how to call into user32.dll  
using a

C# wrapper:

 http://www.voidspace.org.uk/ironpython/winforms/part10.shtml

Alternatively you can try clrtype.py that comes with IronPython 2.6.

All the best,

Michael Foord




Suggestions



___
Users mailing list
us...@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


--http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on  
behalf of your employer, to release me from all obligations and  
waivers arising from any and all NON-NEGOTIATED agreements,  
licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap,  
confidentiality, non-disclosure, non-compete and acceptable use  
policies ("BOGUS AGREEMENTS") that I have entered into with your  
employer, its partners, licensors, agents and assigns, in  
perpetuity, without prejudice to my ongoing rights and privileges.  
You further represent that you have the authority to release me  
from any BOGUS AGREEMENTS on behalf of your employer.


___
Users mailing list
us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/ 
users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Calling a System DLL In IronPython?

2010-01-23 Thread David McWright
Is there a reference somewhere for PInvoke or ctypes in IP?

TIA,
David

On Jan 23, 7:31 pm, Michael Foord  wrote:
> On 24/01/2010 00:19, Andrew Evans wrote:
>
> > I am trying to call user32.dll into IronPython how do I do this? Do I
> > use clr.AddReference, that doesn't seem to do it.
>
> clr.AddReference only works for .NET assemblies. user32.dll is not a
> .NET assembly. To use it you will either need PInvoke or ctypes that
> comes with IronPython 2.6.
>
> PInvoke relies on .NET attributes. It used to be the case that you
> couldn't use these directly with IronPython but needed a simple C#
> wrapper. The following article shows how to call into user32.dll using a
> C# wrapper:
>
>      http://www.voidspace.org.uk/ironpython/winforms/part10.shtml
>
> Alternatively you can try clrtype.py that comes with IronPython 2.6.
>
> All the best,
>
> Michael Foord
>
>
>
> > Suggestions
>
> > ___
> > Users mailing list
> > us...@lists.ironpython.com
> >http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>
> --http://www.ironpythoninaction.com/http://www.voidspace.org.uk/blog
>
> READ CAREFULLY. By accepting and reading this email you agree, on behalf of 
> your employer, to release me from all obligations and waivers arising from 
> any and all NON-NEGOTIATED agreements, licenses, terms-of-service, 
> shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, 
> non-compete and acceptable use policies ("BOGUS AGREEMENTS") that I have 
> entered into with your employer, its partners, licensors, agents and assigns, 
> in perpetuity, without prejudice to my ongoing rights and privileges. You 
> further represent that you have the authority to release me from any BOGUS 
> AGREEMENTS on behalf of your employer.
>
> ___
> Users mailing list
> us...@lists.ironpython.comhttp://lists.ironpython.com/listinfo.cgi/users-ironpython.com
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


Re: [IronPython] Calling a System DLL In IronPython?

2010-01-23 Thread Michael Foord

On 24/01/2010 00:19, Andrew Evans wrote:
I am trying to call user32.dll into IronPython how do I do this? Do I 
use clr.AddReference, that doesn't seem to do it.


clr.AddReference only works for .NET assemblies. user32.dll is not a 
.NET assembly. To use it you will either need PInvoke or ctypes that 
comes with IronPython 2.6.


PInvoke relies on .NET attributes. It used to be the case that you 
couldn't use these directly with IronPython but needed a simple C# 
wrapper. The following article shows how to call into user32.dll using a 
C# wrapper:


http://www.voidspace.org.uk/ironpython/winforms/part10.shtml

Alternatively you can try clrtype.py that comes with IronPython 2.6.

All the best,

Michael Foord



Suggestions


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
   



--
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your 
employer, to release me from all obligations and waivers arising from any and all 
NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, 
confidentiality, non-disclosure, non-compete and acceptable use policies ("BOGUS 
AGREEMENTS") that I have entered into with your employer, its partners, licensors, 
agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. 
You further represent that you have the authority to release me from any BOGUS AGREEMENTS 
on behalf of your employer.


___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com


[IronPython] Calling a System DLL In IronPython?

2010-01-23 Thread Andrew Evans
I am trying to call user32.dll into IronPython how do I do this? Do I use
clr.AddReference, that doesn't seem to do it.

Suggestions
___
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com