Compiler error for ProcessIdToSessionId

Just starting out? Need help? Post your questions and find answers here.
BarryG
Addict
Addict
Posts: 4126
Joined: Thu Apr 18, 2019 8:17 am

Compiler error for ProcessIdToSessionId

Post by BarryG »

[Edit] Sorry, forgot that I posted about this before -> viewtopic.php?f=43&t=78145
Last edited by BarryG on Wed Mar 08, 2023 10:28 am, edited 4 times in total.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: Compiler error for ProcessIdToSessionId

Post by juergenkulow »

Code: Select all

// !db 'ProcessIdToSessionId',0x0
db 'ProcessIdToSessionId',0x0
"db 'ProcessIdToSessionId',0x0" is valid programming code in FASM, but unfortunately not in C programming language.
Mijikai Re: detect if windows session is locked

Code: Select all

PureBasic 6.01 LTS beta 4 - C Backend (Windows - x64)
Loading 'C' subsystem
Compiling D:\p2s.pb
Loading external libraries...
Starting compilation...
43 lines processed.
Error: Assembler
error: 'db' undeclared (first use in this function)
 db 'ProcessIdToSessionId',0x0
 ^~
purebasic.c:224:1: note: each undeclared identifier is reported only once For each function it appears in
purebasic.c:224:3: error: expected ';' before '\x6f6e4964'
 db 'ProcessIdToSessionId',0x0
   ^~~~~~~~~~~~~~~~~~~~~~~
   ;
purebasic.c:228:4: warning: character constant too long For its type
 db 'WTSQuerySessionInformationW',0x0
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
purebasic.c:228:3: error: expected ';' before '\x696f6e57'
 db 'WTSQuerySessionInformationW',0x0
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ;
purebasic.c:232:4: warning: character constant too long For its type
 db 'WTSFreeMemory',0x0
    ^~~~~~~~~~~~~~~
purebasic.c:232:3: error: expected ';' before '\x6d6f7279'
 db 'WTSFreeMemory',0x0
   ^~~~~~~~~~~~~~~~
   ;
purebasic.c:136:1: error: label 'll_islocked_wtsfreememory' used but Not defined
 integer p2=(integer)la_ll_islocked_wtsfreememory;
 ^~~~~~~
purebasic.c:132:1: error: label 'll_islocked_wtsquerysessioninformation' used but Not defined
 integer p1=(integer)la_ll_islocked_wtsquerysessioninformation;
 ^~~~~~~
User avatar
mk-soft
Always Here
Always Here
Posts: 6204
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [Done] Compiler error for ProcessIdToSessionId

Post by mk-soft »

There are already some codes here that generate different code with CompilerIf options for ASM and C-backend.

Unfortunately, I also see some that implement ASM adapted in C-backend. But these codes do not run on ARM processors. And when the first PB version for Window ARM comes (is planned in the futures), then the problems with ASM will start again.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Done] Compiler error for ProcessIdToSessionId

Post by Fred »

PB ARM uses the C backend, so it shouldn't be an issue if you write a C version of your subroutine
User avatar
mk-soft
Always Here
Always Here
Posts: 6204
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: [Done] Compiler error for ProcessIdToSessionId

Post by mk-soft »

I am aware of that,

but some people put ASM-Intel commands in the c-backend, which then leads to errors on ARM.
I just wanted to remind you that this is not a good way.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: [Done] Compiler error for ProcessIdToSessionId

Post by Fred »

Ho yes, you're totally right here.
juergenkulow
Enthusiast
Enthusiast
Posts: 581
Joined: Wed Sep 25, 2019 10:18 am

Re: [Done] Compiler error for ProcessIdToSessionId

Post by juergenkulow »

Code: Select all

; EnableASM  or ! somecode(); generates an Error Message in C Backend. 
CompilerIf #PB_Backend_C=#PB_Compiler_Backend
  CompilerError "Inline assembler is not allowed in C backend."
CompilerEndIf
Post Reply