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

fix twrong_refcounts in nim cpp mode #10313

Merged
merged 1 commit into from
Jan 15, 2019

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Jan 15, 2019

twrong_refcounts was failing in cpp mode because getRefcount from

lib/system/gc.nim:131:50:proc internRefcount(p: pointer): int {.exportc: "getRefcount".} =

gets mangled as C++ in nim cpp:

nm stdlib_system.cpp.o|grep getRefcount
000000000000d140 T __Z11getRefcountPv

whereas on the import side:

proc getRefcount*[T](x: ref T): int {.importc: "getRefcount", noSideEffect,
  deprecated: "the refcount never was reliable, the GC does not use traditional refcounting".}

gets the declaration mangled as extern C, not extern C++, which points to a limitation we should address soon, such as ability to have extern C exportc procs in nim cpp ( a few syntaxes were discussed; will be addressed in future PR's)

So this PR introduces a workaround until we get ability to have extern C exportc procs in nim cpp

after this PR and #10310 there'll be 1 2 last failing tests before we can enable remove allow_failures for env: NIM_COMPILE_TO_CPP=true:

  • tests/niminaction/Chapter8/sdl/sdl_test.nim
  • tests/objects/tobjcov.nim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants