Skip to content

Conversation

simonkrauter
Copy link
Contributor

I look up, how an error message for an unhanded exception is thrown in excpt.nim, and changed dyncalls.nim to the same behavior.

I look up, how an error message for an unhanded exception is thrown in excpt.nim, and changed dyncalls.nim to the same behavior.

proc nimLoadLibraryError(path: string) =
when defined(guiapp):
discard MessageBoxA(0, msg, "could not load: " & path, 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This uses & which uses the GC. Boehm GC is loaded as a DLL --> crash if Boehm cannot be loaded. You need to use some low level stuff to fill an array[Size, char] and pass that to MessageBoxA. Also MessageBoxA is already declared in excpt.nim.

@simonkrauter
Copy link
Contributor Author

@Araq Now it should be good, please review again.

proc nimGetProcAddr(lib: LibHandle, name: cstring): ProcAddr {.
error: "nimGetProcAddr not implemented".}

proc nimLoadLibraryError(path: string) = {.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong, don't mess with the genode path please.


proc nimLoadLibraryError(path: string) =
# carefully written to avoid memory allocation:
when defined(guiapp):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when defined(windows) and defined(guiapp)

and then you can merge the two nimLoadLibraryError implementations.

@simonkrauter
Copy link
Contributor Author

Sorry, my code was bad, I will redo it in a new PR.

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