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

asyncdispatch could not be linked to nimrtl #6855

Closed
enthus1ast opened this issue Dec 1, 2017 · 5 comments
Closed

asyncdispatch could not be linked to nimrtl #6855

enthus1ast opened this issue Dec 1, 2017 · 5 comments
Labels
Async Everything related to Nim's async Garbage Collection Severe

Comments

@enthus1ast
Copy link
Contributor

testfile.nim:

import asyncdispatch
nim c -r -d:useNimRtl testfile.nim

build failes with:

Hint: used config file '/home/z/Nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: l [Processing]
Hint: asyncdispatch [Processing]
Hint: os [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: math [Processing]
Hint: algorithm [Processing]
Hint: times [Processing]
Hint: posix [Processing]
Hint: ospaths [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: heapqueue [Processing]
Hint: lists [Processing]
Hint: options [Processing]
Hint: typetraits [Processing]
Hint: asyncstreams [Processing]
Hint: asyncfutures [Processing]
Hint: deques [Processing]
Hint: nativesockets [Processing]
Hint: net [Processing]
Hint: sets [Processing]
Hint: selectors [Processing]
Hint: epoll [Processing]
Hint: macros [Processing]
lib/pure/asyncdispatch.nim(1545, 61) template/generic instantiation from here
lib/pure/asyncmacro.nim(301, 55) Error: cannot 'importc' variable at compile time
@enthus1ast enthus1ast changed the title asyncdispatch in dll could not be linked to nimrtl asyncdispatch could not be linked to nimrtl Dec 1, 2017
@andreaferretti andreaferretti added the Async Everything related to Nim's async label Dec 1, 2017
@xomachine
Copy link
Contributor

xomachine commented Jan 15, 2018

It is not only an asyncdispatch issue. Any usage of procs related to GC (e.g. strutils.split) in the compile time code with -d:useNimRtl causes this error.

@ccll
Copy link

ccll commented Sep 6, 2018

@xomachine Yes, I've encountered the strutils error, related issue #8405.

@dom96 dom96 added Garbage Collection Misc and removed Async Everything related to Nim's async labels Sep 6, 2018
@sinkingsugar
Copy link
Contributor

sinkingsugar commented Sep 12, 2018

Just when I was about to release a Unity plug-in... I hit this too...
What's weird is that even without nim rtl I have issues with async and gc.

@sinkingsugar
Copy link
Contributor

Update:
In the case of Unity engine, actually any gc except regions/none will crash for some reason with the current nim. I will investigate more, hard to gdb unity reliably, repro is easy tho.

@sinkingsugar
Copy link
Contributor

Update on my specific case, fixed, basically:
With this PR which is already in devel: #8975

In a nutshell:
Each dll will have a different C++ namespace so no useNimRtl is necessary at all.
Just one remark: using vars in the global scope is asking for trouble. Make sure your plugin dlls use something like a var ctx = cast[Context](alloc0(sizeof(Context))) to hold your context rather than global scope.

Having multiple GCs could be avoided but it's not going to be the end of the world unless you really have way too many dlls, but in that case you should have memory management built-in in your program. Can't wait for --gc:destructors indeed.

@Araq Araq added the Severe label Sep 19, 2018
@krux02 krux02 added Async Everything related to Nim's async and removed Misc labels Oct 28, 2018
@Araq Araq closed this as completed in f03391d May 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Async Everything related to Nim's async Garbage Collection Severe
Projects
None yet
Development

No branches or pull requests

8 participants