Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ MSSQL在库中找不到该函数_C++_Sql Server_Sql Server 2008_Extended Procedures - Fatal编程技术网

C++ MSSQL在库中找不到该函数

C++ MSSQL在库中找不到该函数,c++,sql-server,sql-server-2008,extended-procedures,C++,Sql Server,Sql Server 2008,Extended Procedures,我想测试扩展存储过程(我知道它们现在已被弃用,但出于个人原因,我想测试它们) 我已经在VC++中生成了一个dll文件,下面是我的代码: //First.h #include<iostream> #include<srv.h> using namespace std; RETCODE _declspec(dllexport) xp_firstfun(SRV_PROC *srvproc); 但如果我尝试执行该函数: exec xp_firstfun 我面临着这个错误

我想测试扩展存储过程(我知道它们现在已被弃用,但出于个人原因,我想测试它们)

我已经在VC++中生成了一个dll文件,下面是我的代码:

//First.h
#include<iostream>
#include<srv.h>

using namespace std;

RETCODE _declspec(dllexport)  xp_firstfun(SRV_PROC *srvproc);
但如果我尝试执行该函数:

exec xp_firstfun
我面临着这个错误:

在库C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\FirstDLL中找不到函数xp\u firstfun。原因:127(未找到程序)

我有两个问题:

  • 我的C++代码正确吗
  • 我是否应该在SQL中执行更多操作以在dll中调用此函数

感谢您的帮助

更改您的声明。这可能会对您有所帮助,因为在c++中,函数名在编译过程中会被修改,这是名称混乱的一部分

extern "C"
{
    RETCODE _declspec(dllexport)  xp_firstfun(SRV_PROC *srvproc);
}
exec xp_firstfun
extern "C"
{
    RETCODE _declspec(dllexport)  xp_firstfun(SRV_PROC *srvproc);
}