c++ cli - Why I am getting this compile error in c++/clr -


i have code:

public ref class nativedll {     dllinterface *dllinterface; public:     nativedll(string ^dllname)     {         msclr::interop::marshal_context context;         std::string stddllname = context.marshal_as<std::string>(dllname);          dllinterface=new dllinterface(stddllname);     }     nativedll()     {         auto assembly= assembly::getexecutingassembly();         string ^path=path::getdirectoryname(assembly->fullname);         auto pathname=path::combine(path,"mydll.dll");         nativedll(pathname);     } }; 

when compile it, getting tis error:

'pathname' : redefinition; different type modifiers  

it generate error on line:

  nativedll(pathname); 

changing pathname generate same error. why getting error?

in c++ cannot call constructor constructor. nor in c++/cli afaik. make method both constructors call instead:

nativedll(string ^dllname) {     initialize(dllname); }  nativedll() {     auto assembly= assembly::getexecutingassembly();     string ^path=path::getdirectoryname(assembly->fullname);     auto pathname=path::combine(path,"mydll.dll");      initialize(dllname); }  void initialize(string ^dllname) {     msclr::interop::marshal_context context;     std::string stddllname = context.marshal_as<std::string>(dllname);      dllinterface=new dllinterface(stddllname); } 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -