Compiler Option: Main source file

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

Compiler Option: Main source file

Post by BarryG »

If I set a main source file in Compiler Options for an included source, will that included source use the same Compiler Options as the main? Or do I need to go in and set things like "Thread safe" for the include file, even if "Thread safe" is set in the main?
User avatar
mk-soft
Always Here
Always Here
Posts: 5333
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Compiler Option: Main source file

Post by mk-soft »

It is enough to set ThreadSafe in the main program.
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
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Compiler Option: Main source file

Post by BarryG »

Good to know. I'm getting illegal memory access errors and despite triple-checking literally everything (with Purifier on and such), I just can't find the cause. Even with OnError lines support on, it reports lines that have no obvious cause. So I wondered if it were because I didn't have "thread safety" turn on in an include file. I guess not. Have to keep looking.
BarryG
Addict
Addict
Posts: 3292
Joined: Thu Apr 18, 2019 8:17 am

Re: Compiler Option: Main source file

Post by BarryG »

I never followed-up on what was causing this error. Turns out I was using procedures without any parameter for the thread, like this:

Code: Select all

Procedure MyThread()
  ; Do something
EndProcedure
CreateThread(@MyThread(),0)
Once I added the required procedure parameter, the crashes stopped:

Code: Select all

Procedure MyThread(null)
  ; Do something
EndProcedure
CreateThread(@MyThread(),0)
A silly mistake to make.
User avatar
HeX0R
Addict
Addict
Posts: 980
Joined: Mon Sep 20, 2004 7:12 am
Location: Hell

Re: Compiler Option: Main source file

Post by HeX0R »

I wouldn't call it a silly mistake, it is more a common mistake.
The sentence in the help should be somehow highlited:
The procedure which you use as a thread must take one parameter and cannot return anything.
Post Reply