MSSQL在库中找不到函数
MSSQL could not find the function in the library
我想测试扩展存储过程(我知道它们现在不推荐使用,但出于个人原因,我想测试它们)。
我已经在VC++中生成了一个dll文件,这是我的代码:
//First.h
#include<iostream>
#include<srv.h>
using namespace std;
RETCODE _declspec(dllexport) xp_firstfun(SRV_PROC *srvproc);
和
//main.cpp
#include<iostream>
#include "First.h"
using namespace std;
RETCODE xp_firstfun(SRV_PROC *srvproc)
{
cout<<"Hello World froom DLL"<< endl;
cin.get();
return 0;
}
我可以用以下命令成功地将此dll添加到数据库:
sp_addextendedproc 'xp_firstfun', 'C:Program FilesMicrosoft SQL ServerMSSQL11.MSSQLSERVERMSSQLBinnFirstDLL.dll'
但是如果我尝试执行函数:
exec xp_firstfun
我面临这个错误:
在库C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\FirstDLL中找不到函数xp_firstfun。原因:127(找不到过程)。
我有两个问题:
- 我的C++代码正确吗
- 我应该在SQL中做更多的事情来调用dll中的此函数吗
感谢您的帮助
更改您的声明。这可能会对您有所帮助,因为在c++中,函数名称在编译过程中会作为名称篡改的一部分进行修改。
extern "C"
{
RETCODE _declspec(dllexport) xp_firstfun(SRV_PROC *srvproc);
}
相关文章:
- 编译器找不到'aligned_alloc'函数
- 在 c++ 中找不到此函数的标识符
- LLVM 选择找不到函数传递
- 找不到 #define 的函数定义
- LD 找不到生成的函数
- C++线程找不到函数作为参数(链接器)
- C++链接编辑器找不到函数声明(未定义的引用)
- C++ python 中的函数来自使用 ctypes 的.dll - 找不到函数和访问冲突
- 为什么C 编译器找不到函数定义
- mingw:使用 -std=c++11 编译时找不到函数
- MSSQL在库中找不到函数
- 编译器找不到函数 glMultiDrawArraysIndirect
- std::调用函数时找不到函数构造函数
- 如果存在具有不同参数类型的重载,则在全局命名空间中找不到函数
- 链接器未解析的外部符号 - 在 dll 中找不到函数
- c++链接错误:编译器找不到函数的定义
- 找不到c++函数参数标识符
- 链接器在命名空间中找不到函数定义
- 托管 C++ 代码找不到函数实现
- 链接器找不到函数定义,LNK2001未解析的外部符号