Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skip_cpp_definitions to gc_cpp.cc #643

Closed
wants to merge 3 commits into from
Closed

Conversation

fruffy
Copy link

@fruffy fruffy commented May 13, 2024

Trying to compile a static BDWGC build with your own overrides for the allocation functions can lead to a duplicate definition error for the C++ operators (new, delete, new[],..). This PR adds a define directive to skip these definitions, if requested.

@ivmai
Copy link
Owner

ivmai commented May 14, 2024

Okay

docs/README.macros Outdated Show resolved Hide resolved
@ivmai
Copy link
Owner

ivmai commented Jun 3, 2024

Is it OK if I change your email of the squashed commit to contact at ruffy.eu ?

@fruffy
Copy link
Author

fruffy commented Jun 3, 2024

Sure!

@ivmai
Copy link
Owner

ivmai commented Jun 3, 2024

Hmm, I don't quite understand the issue: if you don't need the definitions in gc_cpp.cc then why do you link with libgccpp.a (or .so)?

ivmai pushed a commit that referenced this pull request Jun 3, 2024
PR #643 (bdwgc).

If clients passes -D SKIP_GCCPP_DEFINITIONS option when building bdwgc,
the new and delete operators are not defined in gc_cpp.cc now (to avoid
duplicate definitions).

* docs/README.macros (SKIP_GCCPP_DEFINITIONS): Document.
* gc_cpp.cc [(!_MSC_VER && !__DMC__ || GC_NO_INLINE_STD_NEW)
&& !GC_INLINE_STD_NEW] (operator new, operator delete, operator new[],
operator delete[]): Do not define if SKIP_GCCPP_DEFINITIONS.
@ivmai
Copy link
Owner

ivmai commented Jun 3, 2024

Anyway, I've merged the patch but changing macro name from SKIP_CPP_DEFINITIONS to SKIP_GCCPP_DEFINITIONS.

@ivmai ivmai closed this Jun 3, 2024
@fruffy
Copy link
Author

fruffy commented Jun 5, 2024

Thank you!

Hmm, I don't quite understand the issue: if you don't need the definitions in gc_cpp.cc then why do you link with libgccpp.a (or .so)?

We also need libgccpp.a because of GC_throw_bad_alloc but since it just one file we could also directly compile it..

@ivmai
Copy link
Owner

ivmai commented Jun 5, 2024

We also need libgccpp.a because of GC_throw_bad_alloc

Use libgctba.a instead

@fruffy
Copy link
Author

fruffy commented Jun 5, 2024

We also need libgccpp.a because of GC_throw_bad_alloc

Use libgctba.a instead

Must have missed this one, let me try.

ivmai added a commit that referenced this pull request Jul 19, 2024
(fix of commit 6e110ee)

PR #643 (bdwgc).

Instead of prohibiting of new and delete operators definition in
gc_cpp.cc, it would be better for the client to link with libgctba.a
(not with libgccpp.a).

* docs/README.macros (SKIP_GCCPP_DEFINITIONS): Remove.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants