Visual Studio 11 Developer Preview中的BitScanForward64问题
BitScanForward64 issue in Visual Studio 11 Developer Preview
我对用C写任何东西都是全新的。我正在编写一个执行二进制操作的辅助DLL(从c#调用)。我得到一个"标识符"BitScanForward64"是未定义的"错误。已获取32位版本。我想这是因为我创建了一个Win32 DLL。
然后我明白了64位版本可能只适用于特定的64位DLL(我假设在新项目向导上是"General"),我可能需要一个单独的32位和64位DLL。是这种情况下,或者我可以有一个DLL运行BitScanForward和BitScanForward64的内在,如果是这样,我怎么去创建它?
下面是我当前的代码:
// C Functions.cpp : Defines the exported functions for the DLL application.
#include "stdafx.h"
//#include <intrin.h>
//#include <winnt.h>
int _stdcall LSB_i32(unsigned __int32 x)
{
DWORD result;
BitScanForward(&result, x);
return (int)result;
}
int _stdcall MSB_i32(unsigned __int32 x)
{
DWORD result;
BitScanReverse(&result, x);
return (int)result;
}
int _stdcall LSB_i64(unsigned __int64 x)
{
DWORD result;
BitScanForward64(&result, x);
return (int)result;
}
int _stdcall MSB_i64(unsigned __int64 x)
{
DWORD result;
BitScanReverse64(&result, x);
return (int)result;
}
可以创建一个DLL来保存这两个操作,但它将是一个仅x64的DLL(因此只能在64位操作系统中的64位进程中使用),如下表所示(还要注意,本质上有一个_
前缀,BitScan*64
函数可能需要它,它们都可以使用它)。
此链接详细介绍了在Visual Studio中创建基于x64的项目,您应该能够从中创建dll。
相关文章:
- 将成员变量添加到共享库中的类中,不会破坏二进制兼容性吗
- .cpp和.h文件中的模板专用化声明
- 反向给定链表中的K节点
- 正在查找文档以获得PS4平台的C++中的设备信息
- enum是C++中的宏变量还是整数变量
- 使用C++库在Android项目中修改gradle中的cmake参数,用于插入指令的测试
- 将字符串存储在c++中的稳定内存中
- 文本文件中的单词链表
- 递归函数计算序列中的平方和(并输出过程)
- 如何从C++中的依赖类型中获得它所依赖的类型
- C++中的"inline"关键字
- 如何运行位于boost/libs/python/example/tutorial目录中的hello.cpp和Jamfil
- 如何使用 < 和 > 命令获取 c++ 中的输入和输出?
- 用C++中的一个变量定义一个常量
- vector.resize()中的分配错误
- 使用指针从C++中的数组中获取最大值
- arr[-1]在c++中的奇怪行为
- 具有奇怪重复模板模式的派生类中的成员变量已损坏
- 将值指定给向量(2D)的向量中的某个位置
- 内置函数可查看CPP中的成员变量