G
Guest
I'm trying to declare CreateFile as an extern from the dll like so:
....
using System.Runtime.InteropServices;
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError=true)]
internal static extern IntPtr CreateFile(
String filename,
UInt32 desiredAccess,
UInt32 shareMode,
IntPtr attributes, // Really, this is the SECURITY_ATTRIBUTES pointer
UInt32 creationDisposition,
UInt32 flagsAndAttributes,
IntPtr templateFile);
namespace CsharpPipes
{
....
I get an error on the "IntPtr" that says:
error CS1518: Expected class, delegate, enum, interface, or struct
with F1 help text of:
A declaration was found that is not supported in a namespace. Inside a
namespace, the compiler accepts only classes, structs, enums, interfaces,
namespaces, and delegates.
I assumed my declaration was outside a namespace(?) What's the proper
syntax to declare CreateFile?
Thanks in advance.
Richard
....
using System.Runtime.InteropServices;
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError=true)]
internal static extern IntPtr CreateFile(
String filename,
UInt32 desiredAccess,
UInt32 shareMode,
IntPtr attributes, // Really, this is the SECURITY_ATTRIBUTES pointer
UInt32 creationDisposition,
UInt32 flagsAndAttributes,
IntPtr templateFile);
namespace CsharpPipes
{
....
I get an error on the "IntPtr" that says:
error CS1518: Expected class, delegate, enum, interface, or struct
with F1 help text of:
A declaration was found that is not supported in a namespace. Inside a
namespace, the compiler accepts only classes, structs, enums, interfaces,
namespaces, and delegates.
I assumed my declaration was outside a namespace(?) What's the proper
syntax to declare CreateFile?
Thanks in advance.
Richard