【发布时间】:2012-12-31 19:25:28
【问题描述】:
是否存在与 C# 的 IntPtr.ZERO 等效的 Java?如果没有,有没有办法在传递给 JNA 库接口调用时实现相同的行为?
我用这个sn-p来表示IntPtr.ZERO:
private static final IntByReference ZERO = new IntByReference(0);
当传递到这个Kernel32 JNA 接口时,我会实现相同的行为吗?:
boolean CreateProcess(String lpApplicationName, String commandLine,
int processAttributes, int threadAttributes,
boolean inheritHandles, int creationFlags,
IntByReference environment, String currentDirectory,
STARTUPINFO startupInfo, PROCESS_INFORMATION processInformation);
因此:
CreateProcess(target, null, 0, 0, false, 4, ZERO, null, sInfo, pInfo)
【问题讨论】:
-
抱歉,好像是指 IntPtr 而不是 IntPtr.Zero。
-
我不是在寻找 IntPtr 的等价物,我需要的是 IntPtr.ZERO 的等价物。
-
我相信
null在JNA中通常等同使用。 -
@msandiford 我相信你的回答是正确的。