473,398 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to resolve this register method address question?

// 1. RPCMethodRegistry.h

typedef int (*RPCMethod)(CRPCParaPacker& packer);

class CRPCMethodEntry
{
public:
int id;
RPCMethod method;
};

class CRPCMethodRegistry
{
private:
CRPCMethodRegistry(void);
CRPCMethodRegistry(CRPCMethodRegistry const&); // No copy
constructor.
CRPCMethodRegistry& operator=(CRPCMethodRegistry const&); // No
assignment.

public:
static CRPCMethodRegistry& GetInstance(void);
virtual ~CRPCMethodRegistry(void);

public:
inline int RegisterMethod(const int nId, const RPCMethod pMethod);
RPCMethod GetMethod(const int nId);

private:
static CRPCMethodEntry entries[256];
static CRPCMethodRegistry instance;
};

// 2. RdbRegistry.h

class CRdbRegistry
{
public:
CRdbRegistry(void);
~CRdbRegistry(void);

public:
static int TestMethod1(CRPCParaPacker& packer);
static int TestMethod2(CRPCParaPacker& packer);
static int TestMethodN(CRPCParaPacker& packer);
};

// 3. RdbRegistry.cpp
CRdbRegistry::CRdbRegistry(void)
{
CRPCMethodRegistry& registry = CRPCMethodRegistry::GetInstance();
registry.RegisterMethod(0, TestMethod1);
registry.RegisterMethod(1, TestMethod2);
registry.RegisterMethod(2, TestMethodN);
}

VS2005 tells a link error, cannot resolute external symbol public: int
__thiscall CRPCMethodRegistry::RegisterMethod(int,int (__cdecl*const)
(class CRPCParaPacker &))" (?
RegisterMethod@CRPCMethodRegistry@@QAEHHQ6AHAAVCRP CParaPacker@@@Z@Z)

How to correct it?

Feb 9 '07 #1
2 1765
Allen wrote:
// 1. RPCMethodRegistry.h

typedef int (*RPCMethod)(CRPCParaPacker& packer);

class CRPCMethodEntry
{
public:
int id;
RPCMethod method;
};

class CRPCMethodRegistry
{
private:
CRPCMethodRegistry(void);
CRPCMethodRegistry(CRPCMethodRegistry const&); // No copy
constructor.
CRPCMethodRegistry& operator=(CRPCMethodRegistry const&); // No
assignment.

public:
static CRPCMethodRegistry& GetInstance(void);
virtual ~CRPCMethodRegistry(void);

public:
inline int RegisterMethod(const int nId, const RPCMethod pMethod);
Here you declared the 'RegisterMethod' member function. Where is
it defined? If the definition exists, the linker is unable to find
it anywhere. You need to tell it. How? Ask in the newsgroup for
your compiler/linker.
RPCMethod GetMethod(const int nId);

private:
static CRPCMethodEntry entries[256];
static CRPCMethodRegistry instance;
};

[...]

VS2005 tells a link error, cannot resolute external symbol public: int
__thiscall CRPCMethodRegistry::RegisterMethod(int,int (__cdecl*const)
(class CRPCParaPacker &))" (?
RegisterMethod@CRPCMethodRegistry@@QAEHHQ6AHAAVCRP CParaPacker@@@Z@Z)

How to correct it?
Define the function.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Feb 9 '07 #2
On 2ÔÂ9ÈÕ, ÉÏÎç11ʱ14·Ö, "Victor Bazarov" <v.Abaza....@comAcast.netwrote:
Allen wrote:
// 1. RPCMethodRegistry.h
typedef int (*RPCMethod)(CRPCParaPacker& packer);
class CRPCMethodEntry
{
public:
int id;
RPCMethod method;
};
class CRPCMethodRegistry
{
private:
CRPCMethodRegistry(void);
CRPCMethodRegistry(CRPCMethodRegistry const&); // No copy
constructor.
CRPCMethodRegistry& operator=(CRPCMethodRegistry const&); // No
assignment.
public:
static CRPCMethodRegistry& GetInstance(void);
virtual ~CRPCMethodRegistry(void);
public:
inline int RegisterMethod(const int nId, const RPCMethod pMethod);

Here you declared the 'RegisterMethod' member function. Where is
it defined? If the definition exists, the linker is unable to find
it anywhere. You need to tell it. How? Ask in the newsgroup for
your compiler/linker.
RPCMethod GetMethod(const int nId);
private:
static CRPCMethodEntry entries[256];
static CRPCMethodRegistry instance;
};
[...]
VS2005 tells a link error, cannot resolute external symbol public: int
__thiscall CRPCMethodRegistry::RegisterMethod(int,int (__cdecl*const)
(class CRPCParaPacker &))" (?
RegisterMethod@CRPCMethodRegistry@@QAEHHQ6AHAAVCRP CParaPacker@@@Z@Z)
How to correct it?

Define the function.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
The difinition is coded in cpp files. Not given here.
I have found the answer.
Because I compile these classes into DLL, so class CRPCMethodRegistry
should be declared dll export.

Feb 9 '07 #3

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

Similar topics

1
by: G Kannan | last post by:
Hey all! I have written a perl script to retrieve information from a HTML Form and insert the data into an Oracle database table. I am gettting the the following error message: "Use of...
12
by: Ioannis Vranos | last post by:
Just some thought on it, wanting to see any explanations. It was advised in this newsgroups that we should avoid the use of keyword register. However it is a language feature, and if it...
9
by: silentlights | last post by:
HI, How could I handle groups of registers in a single function by passing the address of the registers to the functions as parameters..? I am trying something like.. typedef volatile struct...
1
by: brcimo | last post by:
Does anyone know if there is a way to get all the IP's associated to a host name from a DNS server? I'm thinking along the lines of Dns.Resolve Method. But as stated in the remarks: . The...
7
by: kvnsdr | last post by:
I can type an IP address and receive Internet domain name and my workstation name however no other IPs of computers on our internal network will resolve to a thier machine name only to the same IP...
5
by: kumarsssss | last post by:
I have just new to degugger. It shows the data registers and address registers. Data registers contatin the data values for the different variables. But what the address registers holds? Does...
26
by: Vashna | last post by:
Hi Group, I have a doubt about register variables. I know that if we have a variable used very frequently in a function, then provided we never apply the & function to it, we can define it as...
1
George Lft
by: George Lft | last post by:
ok, first of all, i built my register page using dreamweaver tool which the codes haven been out of control. Now i'm thinking that turning over everything - by using this another set of codes. And...
5
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I am trying to get the DNS name of an arbitrary IP address on the network. If I use GetHostEntry as the documentation suggests I only get the name of the machine I am running the code on. All...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.