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

L

Leif902

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
 
V

Victor Bazarov

Leif902 said:
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.

<shrug> If 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
 
L

Leif902

Don't create it in the DLL, create it in the application.


<shrug> If 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
 
L

Leif902

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,954
Messages
2,570,116
Members
46,704
Latest member
BernadineF

Latest Threads

Top