[IronPython] Null pointer passing

Kaveripakam, Sathish Sathish.Kaveripakam at phonak.com
Mon Dec 17 13:43:37 CET 2007


I tried using "IntPtr.Zero", but doesnt seems to work. During execution,
it complains "name IntPtr not defined". I am using Iron python 1.1
version and also I have a link to the system path, to pick the Iron path
Stub libraries (ie FEPY project).



-----Original Message-----
From: users-bounces at lists.ironpython.com
[mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Montag, 17. Dezember 2007 13:26
To: Discussion of IronPython
Subject: Re: [IronPython] Null pointer passing

Try IntPtr.Zero

Michael
http://www.manning.com/foord

Kaveripakam, Sathish wrote:
> HI All,
>  
> I am trying to call  Windows CreateFile function from iron Python. I 
> have a dll (c# dll , which has "extern entry" to Create File and I am 
> importing  Kernel32.dll). The problem is, when I am trying to pass the

> arguments, which is of null type, I used "None" in the iron python.
> But during execution, I get an error saying that "Expected IntPtr but 
> got NoneType".
>  
> Could you please let me know, if I am missing something, which is 
> primitive .
>  
>  
> *Iron python Call:*
>  
> x = Win_dll.CreateFile( '\\\\.\\TEST\\test',
>                                     GENERIC_READ|GENERIC_WRITE ,
>                                     FILE_SHARE_READ|FILE_SHARE_WRITE,
>                                     None,
>                                     OPEN_EXISTING,
>                                     FILE_FLAG_WRITE_THROUGH,
>                                     None
>                                 )
>  
>
> public class Win_dll{
>
>                     [DllImport("Kernel32.dll")]
>
>                   public static extern IntPtr CreateFile( string 
> FileName, uint DesiredAccess, uint ShareMode,IntPtr 
> SecurityAttributes,uint CreationDisposition,uint 
> FlagsAndAttributes,IntPtr TemplateFile);
>
> }}
>
> ----------------------------------------------------------------------
> --
> _Legal Notice:_
> The information in this electronic transmission may contain 
> confidential or legally privileged information and is intended solely 
> for the individual(s) named above. If you are not an intended 
> recipient or an authorized agent, you are hereby notified that 
> reading, distributing, or otherwise disseminating, copying or taking 
> any action based on the contents of this transmission is strictly 
> prohibited. Any unauthorized interception of this transmission is 
> illegal under law. If you have received this transmission in error, 
> please notify the sender by telephone [at the number indicated 
> above/on +41 58 928 0101] as soon as possible and then destroy all 
> copies of this transmission.
> ----------------------------------------------------------------------
> --
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>   

_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
******************** 
Legal Notice: 
The information in this electronic transmission may contain confidential or
legally privileged information and is intended solely for the individual(s)
named above. If you are not an intended recipient or an authorized agent,
you are hereby notified that reading, distributing, or otherwise
disseminating, copying or taking any action based on the contents of this
transmission is strictly prohibited. Any unauthorized interception of this
transmission is illegal under law. If you have received this transmission in
error, please notify the sender by telephone [at the number indicated above/
on +41 58 928 0101] as soon as possible and then destroy all copies of this
transmission. 
********************



More information about the Ironpython-users mailing list