473,387 Members | 1,619 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,387 software developers and data experts.

Passing C++ Class pointers via C# to another C++ Class

Hi.

I have a C# application that is in need of fetching a C++ class pointer held within a COM object and pass that through to another COM object to populate an equivilent C++ class pointer.

ie:
COM class One creates a class Apple.
COM class Two needs to use COM Class one's instance of Apple.

However, C# application is only link between them.

I have created the ref/out methods on the COM object to pass out the Apple class pointer. Conversely, the other COM object has a method to accept by reference an object.

The trick is what object??

this is the class that sends and needs the pointer
STDMETHODIMP CLogger::get_logClassPtr(LONG ** pVal)
{
*pVal = (LONG*)&pLog;
return S_OK;
}

STDMETHODIMP CLogger::putref_logClassPtr(LONG * newVal)
{
fCreatedInternally = false;
pLog = (CCQLog *)newVal;
return S_OK;
}

this is the link between them
ILogger pLog;
pLog = new CLoggerClass();
ICLIWrapper pDB;
pDB = new CCLIWrapperClass();
pDB.setLogClass = pLog.get_logClassPtr();

(I'm a c++ person, not a c# person ;) )

Eric
Oct 23 '08 #1
0 1437

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Newsgroup - Ann | last post by:
Gurus, I have the following implementation of a member function: class A { // ... virtual double func(double v); void caller(int i, int j, double (* callee)(double)); void foo() {caller(1,...
6
by: Garma | last post by:
According to what I have learnt so far, instantiating global objects should be the last resort. Is there any reasons why so? Sometimes some objects or their pointers have to be shared among...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
9
by: justanotherguy63 | last post by:
Hi, I am designing an application where to preserve the hierachy and for code substitability, I need to pass an array of derived class object in place of an array of base class object. Since I...
3
by: John C | last post by:
Hi, I am a little uncertain about the concept of passing a reference to a class to another instance of a class. for instance I thought that the following was ok: Network network = Network();...
6
by: Adam Hartshorne | last post by:
Hi All, I have the following setup. Two 'std::vector's which i iterate through in a for (iterate through vector1 of types X) { for (iterate through vector2 of types Y) { f(x) }
8
by: kalinga1234 | last post by:
there is a problem regarding passing array of characters to another function(without using structures,pointer etc,).can anybody help me to solve the problem.
6
by: keepyourstupidspam | last post by:
Hi, I want to pass a function pointer that is a class member. This is the fn I want to pass the function pointer into: int Scheduler::Add(const unsigned long timeout, void* pFunction, void*...
1
by: quat | last post by:
I have two unmanaged pointer in a managed form class: IDirect3D9* d3dObject; IDirect3DDevice9* d3dDevice; In a member function of the form, I call: d3dObject->CreateDevice(...
18
by: tbringley | last post by:
I am a c++ newbie, so please excuse the ignorance of this question. I am interested in a way of having a class call a general member function of another class. Specifically, I am trying to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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...

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.