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

Safecall problem? #9218

Closed
rlsdevine opened this issue Oct 5, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@rlsdevine
Copy link

commented Oct 5, 2018

Hi - I'm trying to compile a simple DLL using safecall. Code is:

proc TestSafeCall(): int {.safecall, exportc, dynlib.} =
  result = 999

And the resulting output in the command window is:

H:\Nim\Projects\DLLSafeCall>nim c -d:release --header --noMain --app:lib DLLSafe
Call.nim
Hint: used config file 'H:\Nim\nimCompiler\config\nim.cfg' [Conf]
Hint: system [Processing]
Hint: DLLSafeCall [Processing]
CC: DLLSafeCall
CC: stdlib_system
Error: execution of an external compiler program 'H:\Nim\nimCompiler\dist\mingw3
2\bin\gcc.exe -c  -w -mno-ms-bitfields -O3 -fno-strict-aliasing  -IH:\Nim\nimCom
piler\lib -o H:\Nim\Projects\DLLSafeCall\nimcache\DLLSafeCall.o H:\Nim\Projects\
DLLSafeCall\nimcache\DLLSafeCall.c' failed with exit code: 1

In file included from H:\Nim\Projects\DLLSafeCall\nimcache\DLLSafeCall.c:10:0:
H:\Nim\Projects\DLLSafeCall\nimcache\DLLSafeCall.c:24:29: error: expected '=', '
,', ';', 'asm' or '__attribute__' before 'TestSafeCall'
 N_LIB_EXPORT N_SAFECALL(NI, TestSafeCall)(void);
                             ^
H:\Nim\nimCompiler\lib/nimbase.h:167:56: note: in definition of macro 'N_SAFECAL
L'
 #  define N_SAFECALL(rettype, name) rettype __safecall name
                                                        ^~~~
H:\Nim\Projects\DLLSafeCall\nimcache\DLLSafeCall.c:32:29: error: expected '=', '
,', ';', 'asm' or '__attribute__' before 'TestSafeCall'
 N_LIB_EXPORT N_SAFECALL(NI, TestSafeCall)(void) {
                             ^
H:\Nim\nimCompiler\lib/nimbase.h:167:56: note: in definition of macro 'N_SAFECAL
L'
 #  define N_SAFECALL(rettype, name) rettype __safecall name
                                                        ^~~~
H:\Nim\Projects\DLLSafeCall>
@Araq

This comment has been minimized.

Copy link
Member

commented Oct 9, 2018

Get a C compiler that supports __safecall?

@Araq Araq closed this in d983d99 Jan 13, 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.