[IronPython] Null pointer passing

Kaveripakam, Sathish Sathish.Kaveripakam at phonak.com
Mon Dec 17 04:05:57 PST 2007


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. 
********************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ironpython.com/pipermail/users-ironpython.com/attachments/20071217/1963a00c/attachment.html 


More information about the Users mailing list