本文介绍了托管C ++ / CLI类中的省略号参数 - VS2010与VS2017的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Hi All,

I have an unmanaged C DLL with a number functions that I need to call from a managed C++/CLI program.
DLL is for accessing an Oracle database thru oci-layer.
Ellipsis parameter in function SQLSelectSingleRow below holds addresses of bind variables in an SQL statement to be executed.
The code shown compiles and runs without problems in Visul Studio 2010, but when I try to compile it in Visual Studio 2017
I get an error regarding ellipsis parameter in SqlOci class :

error C3269: 'SqlOciDll::SQLSelectSingleRow': a member-function of a managed type cannot be declared with '...'


Can this be solved with some changed to the managed code in VS2017, or will it be neccesary to make some change in the unmanaged DLL ?


Thanks in advance,
Henrik

// SqlOciDll.h

#pragma once

#include <std.h>
#include <sqloci.h>

using namespace System::Runtime::InteropServices;

ref class SqlOciDll
{
public :
   [DllImportAttribute("EmSqlOci.dll", CallingConvention=CallingConvention::Cdecl)]
   static RC _loadds SQLSelectSingleRow(SELECT*, ...);
};


// Use SqlOciDll
int main(array<System::String ^> ^args)
{
   int BindVar1 = 5;
   long BindVar2 = 20;

   SqlOciDll::SQLSelectSingleRow(&SelectTagName, &BindVar1, &BindVar2);
}





推荐答案

 


[DllImport(
" EmSqlOci" ,CallingConvention =
CallingConvention :: Cdecl
)]


RC
_ loadds SQLSelectSingleRow2(
SELECT *,...);


 


namespace SqlOciDll


{


  
[DllImport(
" EmSqlOci" ,CallingConvention =
CallingConvention :: Cdecl
)]

  [DllImport( "EmSqlOci", CallingConvention =CallingConvention::Cdecl )]


  
RC

_ loadds SQLSelectSingleRow3(
SELECT *,...);


};

 


这篇关于托管C ++ / CLI类中的省略号参数 - VS2010与VS2017的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 01:08