473,698 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error C3767: candidate function(s) not available

Using VS2005Beta 2 I have VC++/CLI class defined in a Class Library DLL as:

#foo.h

namespace foo
{
public ref class Convert
{
public:
static Obj^ ToObj(Unmanaged Obj* uObj);
};
}

Calling this static method from another VC++/CLI class in another Class
Library DLL as:

Obj^ obj = NULL;
obj = foo::Convert::T oObj(uObj);

results in a compilation error C3763: 'foo::Convert:: ToObj': candidate
function(s) not accessible.

This worked fine in VS2003 and VS2005Beta1, any idea what's going on here?

Thanks,
Steve
Nov 17 '05 #1
3 5473

--
Kapil Khosla, Visual C++ Team
This posting is provided AS IS with no warranties, and confers no rights
"Steve Jaworski" wrote:
Using VS2005Beta 2 I have VC++/CLI class defined in a Class Library DLL as:

#foo.h

namespace foo
{
public ref class Convert
{
public:
static Obj^ ToObj(Unmanaged Obj* uObj);
};
}

Calling this static method from another VC++/CLI class in another Class
Library DLL as:

Obj^ obj = NULL;
obj = foo::Convert::T oObj(uObj);

results in a compilation error C3763: 'foo::Convert:: ToObj': candidate
function(s) not accessible.

This worked fine in VS2003 and VS2005Beta1, any idea what's going on here?

Thanks,
Steve


The problem is with your native type in the managed function signature. From
what it looks like, that type is private and you must explicitly declare
public accessiblity for it.

Look at the previous thread on the same topic by searching for C3767 on
msdn.microsoft. com/visualc,

Thanks,
Kapil

Nov 17 '05 #2
Steve Jaworski wrote:
results in a compilation error C3763: 'foo::Convert:: ToObj': candidate
function(s) not accessible.


I had the same problem before. I think this link is extremely helpful:
http://tinyurl.com/7fw59

If I understand it correctly, when you want to use native types in the
signature of public managed methods in an assembly, you have to make the
unmanaged class public for the assembly.

Try to add this line to your code:
public class __declspec(dlle xport) UnmanagedObj {};

Let us know if this solves your problem.

Tom
Nov 17 '05 #3
I've been doing an experiment to see if I can design a simple managed
wrapper around an unmanaged class, but faced a small problem that may be
a compiler bug.

I created an unmanaged DLL first:

// unmanaged.h
#ifdef UNMANAGED_EXPOR TS
#define UNMANAGED_IMPOR T __declspec(dlle xport)
#else
#define UNMANAGED_IMPOR T __declspec(dlli mport)
#endif
#ifdef _MANAGED
public
#endif
class UNMANAGED_IMPOR T UnClass
{
public:
int Square(int x) { return x * x; }
};

Then I created a managed assembly wrapper:

//managed.h
#pragma once
#include "unmanaged. h"
public ref class Class1
{
public:
Class1() : p(new UnClass) { }
~Class1() { delete p;}
UnClass* get() { return p; }
private:
UnClass* p;
};

And finally a managed test application:

// test.cpp
#include "unmanaged. h"
#using "managed.dl l"
using namespace System;
int main(array<Syst em::String^>^ args)
{
Class1 c;
UnClass* p = c.get();
p->Square(10); // this works
// c.get()->Square(10); // ERROR!!! why?
return 0;
}

I used the
#ifdef _MANAGED
public
#endif
trick to make my unmanaged class public, to avoid the "C3767: candidate
function not available" error, which the original poster had. It works
nicely.

However, there's one glitch. The following doesn't work in test.cpp:

c.get()->Square(10);

I get a compiler error C2039: 'Square': is not a member of 'UnClass'. I
don't understand why, it obviously is a member. I'm forced to assign the
output of the c.get() call to temporary variable 'p', or explicitly
cast, like this:

static_cast<UnC lass*>(c.get())->Square(10);

Since c.get() returns UnClass*, the cast is not necessary, and I
shouldn't be getting a compiler error. Is this expected behavior, or is
it a bug in Beta 2?

Tom
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
9536
by: deko | last post by:
After developing an MDB in Access 2003 on WS03, then making it into an MDE and deploying it on a WinXP box with Access 2003 installed, I get this error: Function is not available in expressions in query expression SELECT IIf(IsNull(),"", & Chr(13) & Char(10)) & IIf(IsNull(),"", & Char(13) & Char(10)) & IIf(IsNull(),"", & Char(13) & Char(10)) & IIf(IsNull(),"",] & IIf(IsNull(),"",", ") &
18
9035
by: Steve | last post by:
Hi I have a really weird problem and any assistance would be welcome. I have developed an app in Access 2002. The app runs perfectly on the development machine. I have packaged the app using the Microsoft XP Developer Packaging Wizard (Service Pack 1). The 1st 3 releases of the app ran perfectly on site.
3
11899
by: pw | last post by:
Hi, I created and distributed an Access 2003 MDE. When the user opens up a form he get's an error message :Function is not available in expressions in query expression 'Trim( & ", " & )'. It works fine at other clients. How can I resolve this? I do not see anything in the MS KB.
5
7232
by: Martin Jørgensen | last post by:
Hello again, Sorry to bother but I guess my C++ book isn't very good since it obviously contains errors so the program code doesn't work with g++. However I don't understand what the problem is. Last time the problem was that "using namespace std" apparently had a "link" class/object defined already. Now I get: error: no matching function for call to 'String::String(String)'
4
10871
by: Cantell | last post by:
Hi everyone I have created a small db, in access 2000, on my own test machines it works excellent, however, upon transferring it to my colleague, I expierience a strange error code Function is not available in query expression - 'Left(!,2)' In English - I am trying to pull the first digits in the date of birth, in example 12/08/2006 - should return 12. This i no problem on my own machine, which have access 2000 (9.0.2812) running on...
1
2616
by: Rymfax | last post by:
Hello, I was hoping someone could help me with a compile issue I'm having in Visual Studio 2005 using the v6.0 Microsoft SDK. I apologize in advance if I'm posting to any groups that don't relate to this topic. I'm just trying to hit the groups that seem relevant. I have an application that is installing Drivers to the OS. I was using the UpdateDriverForPlugAndPlayDevices() function to handle this. It works fine, but on VISTA I get...
8
5310
by: Jess | last post by:
Hi, I have a template function that triggered some compiler error. The abridged version of the class and function is: #include<memory> using namespace std; template <class T>
5
6104
by: elie.constantine | last post by:
Hello A person developed a Microsoft Access Solution and gave me the MDE file. When I tried to run it, I got "Function is not available in expressions in query expression 'Trim([......" Error. I learnt from the Microsoft Website and from this Group that this is problem is the result of a mismatch between the Computer where this database was developed and compiled on and the Computer where I am trying to run it.
1
3048
by: Alberto Menchen | last post by:
Hi, I'm Alberto. I am trying to compile a program but I have an error that I don't know to solve. This program was built some years ago. Two mains problems, I think is in: doc/Makefile.am:24: `:='-style assignments are not There are other lines like this, but I think that if I know to solve this, I will know to do the others. And the other problem is with a specific function: zclient.c: In function ‘zclient_start’: zclient.c:427:...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9028
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8895
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4369
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3046
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2330
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.