I don't know if anyone will find this useful, but I sure will so I thought I'd post it :D
When you compile your blitz program, some temporary files are created, the .i, .o and .s for each of the code files. I thought it'd be good to be able to use these files, and not knowing anything about how compilers work, I decided to play around with a few things.
Firstly, I created two source files:
Compile main.bmx, and your executable will be created, as well as the temporary files. Let's grab the "test.bmx.o" and rename as "test.o" and put it in the directory where "main.bmx" is.
Now, change main.bmx to:
Again, compile main.bmx again, and your executable will be created as usual, but using the .o file instead of the source file. This method could be useful for writing code libraries without giving your source code away, if you don't want to create your own module.
I haven't had time to test this with types etc, but will post here when I've done that.
Also, this may be a windows only thing, so if anyone could test this on a mac or linux, that would be very helpful.
When you compile your blitz program, some temporary files are created, the .i, .o and .s for each of the code files. I thought it'd be good to be able to use these files, and not knowing anything about how compilers work, I decided to play around with a few things.
Firstly, I created two source files:
'*** test.bmx *** Strict Function ThisIsATest() Print("This is a test!!") EndFunction
'*** main.bmx *** Strict Import "test.bmx" ThisIsATest() End
Compile main.bmx, and your executable will be created, as well as the temporary files. Let's grab the "test.bmx.o" and rename as "test.o" and put it in the directory where "main.bmx" is.
Now, change main.bmx to:
'*** main.bmx *** Strict Import "test.o" Extern Function ThisIsATest()="bb_ThisIsATest" EndExtern ThisIsATest() End
Again, compile main.bmx again, and your executable will be created as usual, but using the .o file instead of the source file. This method could be useful for writing code libraries without giving your source code away, if you don't want to create your own module.
I haven't had time to test this with types etc, but will post here when I've done that.
Also, this may be a windows only thing, so if anyone could test this on a mac or linux, that would be very helpful.