473,396 Members | 2,020 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,396 software developers and data experts.

Marshalling reference to an object

Hi,

Once I wrote a dll with some methods. In that dll, there are several
classes. There is for example a Tracer class. In that Tracer class,
there is a method:

Tracer& instance();

Which returns a reference to a Tracer object.(singleton
implementation)
Now I want to use this method in C#. So I wrote a c# class which
import that method:

[DllImport("Tracer_1_0d.dll", EntryPoint="#120")][return :
MarshalAs(???)]
public static extern ??? instance();

What should I write in the place of the questionmarks?
Or am i doing something wrong (if you can tell me what, I hope so)?

regards

Steven
Nov 15 '05 #1
1 1119
Steven,

It would be a lot easier to work with this kind of C++ API from
Managed C++, so I recommend that you do that instead and write MC++
wrapper classes that you can more easily use from C#.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2

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

Similar topics

10
by: Bjarke Lindberg | last post by:
Hey NG. Using .NET remoting it's possible to "override" the <c>new</c> operator to return a proxy to the object in question. I'd like to use this approach to let a factory class return the...
3
by: Jerry Houston | last post by:
In a winform application, I use worker threads to perform asynchronous tasks (e.g., mail merge with Word). The thread procs need to gather some user options from controls in the UI, and I know...
0
by: Shashank Date | last post by:
/* C# Gurus, I am trying to use interop marshalling to call SetCommTimeouts win32 API. But I keep getting the "Object reference not set to an instance of an object" error. Can anybody help...
1
by: Steve | last post by:
I have two objects, each on a different thread. Object 1 periodically fires an event, which Object 2 sinks. How can I marshall the event from Object 1 to the thread on Object 2?
3
by: awk | last post by:
Hi All I have a com dll written in VB6 (it's a User Function Library for my crystal reports - this allows me to write custom functions for Crystal which can be applied in Crystal formulas - none...
2
by: Peter Wone | last post by:
I've written a class which does some long running background processing and returns multiple results via events. The class has an Execute() method which creates a thread and runs an internal method...
10
by: Bryce Calhoun | last post by:
Hello, First of all, this is a .NET 1.1 component I'm creating. SUMMARY ----------------------- This component that I'm creating is, for all intents and purposes, a document parser (I'm...
2
by: calenlas | last post by:
Hi all, I'm taking my first steps into C# <--C++ DLL Interop and unfortunately I've run into (what seems to be) a very complicated case as my first task. Perhaps someone here can help me. I...
1
by: schaf | last post by:
Hi all! My application (app1) is using a service via .NET Renmoting written in .NET 1.1. Now I have converted app1 to .NET 2.0. When I start my application app1 (now in .NET 2.0) the following...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.