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

Comments

Projects
None yet
8 participants
@enthus1ast
Copy link
Contributor

commented Dec 1, 2017

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 label Dec 1, 2017

@xomachine

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link

commented Sep 6, 2018

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

@dom96 dom96 added GC Misc and removed Async labels Sep 6, 2018

@sinkingsugar

This comment has been minimized.

Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor

commented Sep 13, 2018

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

This comment has been minimized.

Copy link
Contributor

commented Sep 19, 2018

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 High Priority label Sep 19, 2018

@krux02 krux02 added Async and removed Misc labels Oct 28, 2018

Araq added a commit that referenced this issue May 10, 2019

@Araq Araq closed this in f03391d May 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.