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

C Library using Hans Boehm GC & Managed C++

I am using an OpenSource library I have wrapped in Managed C++.
There is no way I can do without it :-(.

Due to on going problem with this library (which I cannot debug as it is not
in a language supported by VS.NET and as GDB is pitifully inadequate) I plan
to compile this library with Boehm GC support.

I wonder if everything will work allright?

basically what I have looks like:
======================

// == The native library interface (which I will recompile with Boehm GC)

// create and destory pointers
struct TheObject { /* ... */ };
struct TheObject * createObject(char *);
void Destroy(struct* theObj); // presumably with GC enabled does nothing

// use it
struct void AMethod(struct TheObject* char* amethod, int param);

// == my MC++ wrapper
public ref class MyNClass
{
public:
MyClass()
{
pointer = createObject("TheObject");
}
~MyClass()
{
Destroy(pointer);
pointer = NULL;
}
AMethod(int p)
{
aMethod(pointer, "amethod", p);
}
private:
struct TheObject * pointer;
}

=====================

Will this all works gracefully?
comments, tips, links or similar experience?
Jun 8 '06 #1
3 1405
Lloyd Dupont wrote:
I am using an OpenSource library I have wrapped in Managed C++.
There is no way I can do without it :-(.

Due to on going problem with this library (which I cannot debug as it
is not in a language supported by VS.NET and as GDB is pitifully
inadequate) I plan to compile this library with Boehm GC support.

I wonder if everything will work allright?


Who knows :) It really depends on the library. That said, there's no
reason that the CLR and the Boehm GC can't co-exist since they'll each be
managing their own separate heap.

-cd
Jun 8 '06 #2
The problem
this object:
public ref class MyNClass
{
public:
MyClass()
{
pointer = createObject("TheObject");
}
~MyClass()
{
Destroy(pointer);
pointer = NULL;
}
AMethod(int p)
{
aMethod(pointer, "amethod", p);
}
private:
struct TheObject * pointer;
}

is in the managed heap.
hence I'm afraid that Boehm GC won't be able to find the "pointer" pointer
and might free it while it is still in use!

well, I'm going to find out....

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:ug**************@TK2MSFTNGP02.phx.gbl...
Lloyd Dupont wrote:
I am using an OpenSource library I have wrapped in Managed C++.
There is no way I can do without it :-(.

Due to on going problem with this library (which I cannot debug as it
is not in a language supported by VS.NET and as GDB is pitifully
inadequate) I plan to compile this library with Boehm GC support.

I wonder if everything will work allright?


Who knows :) It really depends on the library. That said, there's no
reason that the CLR and the Boehm GC can't co-exist since they'll each be
managing their own separate heap.

-cd

Jun 8 '06 #3
"Lloyd Dupont" <net.galador@ld> wrote in message
news:ub**************@TK2MSFTNGP02.phx.gbl...
The problem
this object:
public ref class MyNClass
{
public:
MyClass()
{
pointer = createObject("TheObject");
}
~MyClass()
{
Destroy(pointer);
pointer = NULL;
}
AMethod(int p)
{
aMethod(pointer, "amethod", p);
}
private:
struct TheObject * pointer;
}

is in the managed heap.
hence I'm afraid that Boehm GC won't be able to find the "pointer" pointer
and might free it while it is still in use!

well, I'm going to find out....


Hmmm.... good point! I hadn't looked at the code you posted closely enough
to appreciate that wrinkle.

-cd
Jun 8 '06 #4

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

Similar topics

4
by: Pedro Miguel Carvalho | last post by:
Greetings. I'm creating a project that as a intricate relation between object kind of like a set where each object in the set can be connect to a subset of object of the set and objects not in...
43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
8
by: HalcyonWild | last post by:
Hi, I installed the free version(command line only) of the digital mars c++ compiler. It said it features a garbage collection mechanism, but there was no documentation. I figured out that...
87
by: Robert Seacord | last post by:
The SEI has published CMU/SEI-2006-TR-006 "Specifications for Managed Strings" and released a "proof-of-concept" implementation of the managed string library. The specification, source code for...
7
by: Ugo Van Noorbeeck | last post by:
Hi all, I try to reference several pages from a class (ideally located in a class library). But no namespace is available to do this. Does anybody have an idea how to do this? Thanks for...
2
by: Nathan Sokalski | last post by:
I am moving my website from my machine to my webhost, and need some help with what extra files I need to include due to the fact that I used AJAX in my site. Everything on the site is obviously...
7
by: Donos | last post by:
Please see the following code :- unsigned char* pChar = new unsigned char; Now am using:- delete pChar; I want to add a condition statement before deleting:-
3
by: Hans-Jürgen Philippi | last post by:
Hi Group, I've created a (very simple) ASP.NET web application with a single *.aspx page and an *.aspx.cs CodeBehind file: By clicking an HTML form button, a text control value is written into a...
53
by: None | last post by:
Hi, I am a game developer, sometimes "indy" and sometimes for a small-sized company. I can't speak for all game developers, but everywhere I've ever seen people working on games, execution...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.