Code: Select all
PureBasic 6.00 LTS (Windows - x64)
Windows 10 [Version 10.0.19044.3086]
I want to use Command from the TakeCmd.lib (yes, it is actually called Command)
Code: Select all
dumpbin /exports takecmd.lib
Code: Select all
?Command@@YAHPEB_WH@Z (int __cdecl Command(wchar_t const *,int))
Code: Select all
int WINAPI Command( LPCTSTR pszLine, int nReserved );
/*
Call the parser to expand and execute pszLine
nReserved - reserved, must be set to 0
Code: Select all
ImportC "takecmd.lib"
Command_(*lpszString, nReserved.i) As "?Command@@YAHPEB_WH@Z"
EndImport
Code: Select all
Command_("pause", 0)
However, using pbcompilerc.exe (C backend), it does not compile, and returns 619 lines of errors;
Code: Select all
PureBasic 6.00 LTS - C Backend (Windows - x64)
Loading 'C' subsystem
Compiling ActiveScript.pb
Loading external libraries...
Starting compilation...
Including source: Modul_ActiveScript.pb
1877 lines processed.
Error: Assembler
purebasic.c: In function 'activescriptsiteXf_onscripterror':
purebasic.c:865:16: warning: passing argument 1 of 'SYS_CopyString' discards 'volatile' qualifier from pointer target type [-Wdiscarded-qualifiers]
SYS_CopyString(v_error);
^~~~~~~
.
.
.
purebasic.c:231:43: note: expected 'TCHAR *' {aka 'void *'} but argument is of type 'volatile void *'
M_SYSFUNCTION(void) SYS_FreeString(TCHAR *String);
~~~~~~~^~~~~~
C:\Users\jlcav\AppData\Local\Temp\ccF8Sg8s.s: Assembler messages:
C:\Users\jlcav\AppData\Local\Temp\ccF8Sg8s.s:3295: Error: invalid character '?' before operand 1
however,
after much time trying to figure out what was wrong in my code,
using the C Backend,
and finding nothing wrong with my code,
using the C Backend,
it was then that I thought to try compiling with the ASM Backend,
which works as it should.
Constructive suggestions as to why this code compiles with the ASM Backend,
but does not compile with the C Backend.
Joe