473,385 Members | 2,162 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,385 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 1412
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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
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.