473,503 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems in a managed Visual C++ project (CLR Class Library)

Hi all,

I'm working on a little project and have hit a roadblock,

I'm trying to make an extension for a program who's extension DLL's
must return either a double or a null terminating string (no void).
This extension is actually a wrapper for another managed DLL which
dosn't follow these rules (my dll will call it's functions and return
the results as doubles and strings which the prog. can understand).

The problem i'm having is this.
Because I can't create global instances of a managed object in Visual C
++ I can not create an instance of the object that can be read and
modified by all the functions in the DLL.
(For instance, if the DLL i'm calling from had a class
"classSettings," I can't create a global instance of it in my DLL to
be read/written to by the functions)

Is there any workaround for this?
I need to be able to have all my functions read/write data from the
same instance of an object, unfortunatly it can't be global.

Thanks, and sorry if this is poorly stated
- Leif

Jul 9 '07 #1
3 2218
Leif902 wrote:
I'm working on a little project and have hit a roadblock,

I'm trying to make an extension for a program who's extension DLL's
must return either a double or a null terminating string (no void).
This extension is actually a wrapper for another managed DLL which
dosn't follow these rules (my dll will call it's functions and return
the results as doubles and strings which the prog. can understand).

The problem i'm having is this.
Because I can't create global instances of a managed object in Visual
C ++ I can not create an instance of the object that can be read and
modified by all the functions in the DLL.
(For instance, if the DLL i'm calling from had a class
"classSettings," I can't create a global instance of it in my DLL to
be read/written to by the functions)

Is there any workaround for this?
Don't create it in the DLL, create it in the application.
I need to be able to have all my functions read/write data from the
same instance of an object, unfortunatly it can't be global.
<shrugIf you cannot use a member of the same class, then it's not
a C++ problem, but rather a managed or/and a DLL proble, and we cannot
really help you solve it -- you need to post to the newsgroup where
"managed" or "DLL" is on topic.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 9 '07 #2
On Jul 9, 5:44 pm, "Victor Bazarov" <v.Abaza...@comAcast.netwrote:
Leif902 wrote:
I'm working on a little project and have hit a roadblock,
I'm trying to make an extension for a program who's extension DLL's
must return either a double or a null terminating string (no void).
This extension is actually a wrapper for another managed DLL which
dosn't follow these rules (my dll will call it's functions and return
the results as doubles and strings which the prog. can understand).
The problem i'm having is this.
Because I can't create global instances of a managed object in Visual
C ++ I can not create an instance of the object that can be read and
modified by all the functions in the DLL.
(For instance, if the DLL i'm calling from had a class
"classSettings," I can't create a global instance of it in my DLL to
be read/written to by the functions)
Is there any workaround for this?

Don't create it in the DLL, create it in the application.
I need to be able to have all my functions read/write data from the
same instance of an object, unfortunatly it can't be global.

<shrugIf you cannot use a member of the same class, then it's not
a C++ problem, but rather a managed or/and a DLL proble, and we cannot
really help you solve it -- you need to post to the newsgroup where
"managed" or "DLL" is on topic.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask- Hide quoted text -

- Show quoted text -
That's the problem, I can't... i don't have access to the application,
this is an expansion for an exisiting application.

But alright, I'll try a different group... I had just hoped someone
knew a simple C++ workaround for this.

Thanks (if anyone else knows anything else...)
- Leif

Jul 10 '07 #3
Just incase anyone else is interested in the solution (I was being an
idiot, it was obvious, as someone else pointed out to me...),

The solution is simply to have a static pointer (or array of
pointers)
to the instance(s) of the object that is set after the instance(s)
creation from an initialization function.
- Leif

Jul 11 '07 #4

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

Similar topics

1
741
by: Bob Rock | last post by:
Hello, in the last few days I've made my first few attempts at creating mixed C++ managed-unmanaged assemblies and looking aftwerwards with ILDASM at what is visible in those assemblies from a...
5
2924
by: Adam McKee | last post by:
We are using Visual Studio.NET 2003 in our project with .NET framework 1.1. One of our libraries is a mixed-mode dll assembly consisting of one managed C++ library, and several unmanaged C++...
5
1718
by: Andrew | last post by:
I want to use a managed c++ class from an unmanaged class. Here is my code: // *** Unmanaged Code // .h file class UnmanagedClass { public: // Other stuff here
4
1445
by: quortex | last post by:
Hi, I have created a very small test wrapper class in Managed C++ which wraps up some very simple native code. I am using C# 2 + Visual Studio 2005 Beta 2. I have the back end C++ library...
3
1948
by: Andreas | last post by:
Hi! I'm currently developing a DLL that makes use of C++ and .net (mixed) using Visual Studio 2003. Now, as I wanted to move to the new Visual Studio 2005, I converted this project into the...
3
12248
by: Cmtk Software | last post by:
I'm trying to define an enum which will be used from unmanaged c++, C++/CLI managed c++ and from C#. I defined the following enum in a VS dll project set to be compiled with the /clr switch: ...
1
2671
by: =?Utf-8?B?SmltIFdhbHNo?= | last post by:
I have an VC++ MFC Win32 application that isn't working correctly when I build it with VS2005. The problem seems to be in some ADO ActiveX controls that came with VS6 and are now out of support....
20
5971
by: Aek | last post by:
We recently moved our large codebase over from VS7 to 8 and found that we now get access violations in atexit calls at shutdown when debugging the application in VS2005. This occurs in static...
5
2783
by: =?Utf-8?B?aWduaGVucnk=?= | last post by:
I have a managed C++ project and two C# projects. All are class library projects. The C++ project links with native C++ static libraries and references to one C# project. The projects structure...
0
7202
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
7086
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
7280
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,...
1
6991
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
5578
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
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3154
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1512
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 ...
1
736
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.