I played around a bit with creating a 2nd thread of QB64 execution:
Note that the program crashes with access violations. I believe that this is because the PRINT statement is probably not re-entrant.
>Only one program would need to write a certain variable, the rest would just read it, so I don't think that synchronization would be an issue.
Simple reads and writes to properly-aligned 32-bit variables are atomic operations. In other words, you will not end up with only one portion of the variable updated; all bits are updated in an atomic fashion. However, access is not guaranteed to be synchronized. If two threads are reading and writing from the same variable, you cannot determine if one thread will perform its read operation before the other performs its write operation.
Simple reads and writes to properly aligned 64-bit variables are atomic on 64-bit Windows. Reads and writes to 64-bit values are not guaranteed to be atomic on 32-bit Windows. Reads and writes to variables of other sizes are not guaranteed to be atomic on any platform.
----- end quote
>What would you recommend, should I just be very careful to make sure all the variables are being distributed correctly or should I look into WriteProcessMemory or something?
I don't know. I think threads are the proper solution, but QB64 isn't mature yet in that regard.
>but both times it created the o and rc files and compiled the program, it just isnt embedding the icon in the exe
When you look at the folder in Windows Explorer, does the icon show up as the .EXE's icon? Note that it won't show up as the application icon while the program is running, because that is an icon that the QB64 program loads manually, and is not a resource in the .EXE file.
>Also when it creates the cpp file when I compile QB64 code, where does it store it? I would like to look at them :)
First of all, note that QB64 can create numbered qbx.cpp files and temp subfolders. I think that this is related to whether you have multiple copies of QB64 open at the same time. If you only have one copy, it seems to not use the numbers.
the main file is:
it #includes various .txt files from your internal\temp subfolder, the most interesting of which will probably be:
There are also other files, like:
and numbered data.txt files for your SUBs and FUNCTIONs.
The object file created by compiling qbx.cpp is statically linked to a precompiled libqbx.o, the source code of which is:
|Response Title||Author and Date|
|Re: Sharing Variables||on Apr 2|
|About the icon...||on Apr 5|
|Thank You!||on Apr 5|
|* yw.||on Apr 5|
|Michael - I watched your video...||on Apr 5|
|* :-)||on Apr 5|