By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

Candidate function(s) not accessible strange case

P: n/a
When trying to call a __gc class static function in an assembly which
has CLR and non-CLR types in its signature, I get a Candidate
function(s) not accessible error.

In an assembly, using /clr:oldSyntax:


// TSEShared.h
#pragma once
#include <string>
using namespace System;
namespace TSEShared {
public __gc class Global
static std::string ToCppString(System::String *);


#include "stdafx.h"
#include "TSEShared.h"
std::string TSEShared::Global::ToCppString(System::String * str)
if (str == 0)
ptr(System::Runtime::InteropServices::Marshal::Str ingToHGlobalAnsi(str));
std::string ret(static_cast<const char *>(static_cast<void *>(ptr)));
System::Runtime::InteropServices::Marshal::FreeCoT askMem(ptr);

Called from another assembly using /clr:oldSyntax which references the
TSEShared assembly.


#pragma once
//#include <string>
namespace UseTSEShared
public __gc class SomeClass {


#include "stdafx.h"
#include "UseTSEShared.h"
TSEShared::Global::ToCppString(0); // compiler error on this line

I do not see the reason why ?

I am trying to create reusable functions in an assembly, which can be
called from other assemblies, which have mixed types in its signature.
Clearly this should be doable. When I tried it within a __nogc class,
exporting the functions, I received an error that functions with clr
calling conventions can not be exported. Now that I try it with a __gc
class, I receive this error.
Mar 20 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.