I want to know more about the .a and .i files

BlitzMax Forums/BlitzMax Programming/I want to know more about the .a and .i files

Tibit(Posted 2006) [#1]
.a and .i files are created when you compile a module.

1. Why are they called a and i and x86?

2.1 How are they compiled?
2.2 Is blitzmax using a compiler itself. Does MinGW have something to do with this? Links?

3. What do they contain?

4. If put in the right directory Ex mod/Pub/somemod.mod/ they can be imported in a blitzmax file and compiled. How does this work?

5. If I in turn include an included file and compile it to .a and .i can I still access all included functions and types in the first included file?

6.1 Is there anyway to use the .a .i files directly?
6.2 Can I import them without using the blitzmax directory structure?

7. Is C or c++ code involved in this? Can a C or c++ program use a .i or .a file from blitzmax in any way?

8. Can I program something in Blitzmax and then import or use it in C++?


N(Posted 2006) [#2]
1) Archive, interface, and architecture.

2.1) Using bcc, gcc, ld, fasm, and ar (and possibly ranlib, although it's not required)
2.2) It uses gcc to compile C, C++, and Objective C source, so yes.

3) The archive file is an archive of compiled object files.

4) Yes, they will be statically linked.

5) Um?

6.1) Yes to the former, I don't believe so to the latter.
6.2) What BlitzMax directory structure?

7) Yes but it would be a bad idea.

8) Technically speaking: yes. However, you would not like the way you do it.


Chris C(Posted 2006) [#3]
Import "libode.a"

can be used, but if you can at all manage it, it is *much* better to import C files

look at //----- file: mytype.cpp -----
in language/advanced topics in the help to see why!


Dreamora(Posted 2006) [#4]
8) Possible but not allowed unless you have a special license from BRL. (same holds for DLLs)


N(Posted 2006) [#5]
8) Possible but not allowed unless you have a special license from BRL.


Only for the BRL modules.


Tibit(Posted 2006) [#6]
2.1) Using bcc, gcc, ld, fasm, and ar (and possibly ranlib, although it's not required)
2.2) It uses gcc to compile C, C++, and Objective C source, so yes.


Does this mean blitzmax turn the basic-code I write into C or c++ code and then compile it in a C compiler?

About 8 (Using blitzmax in C++)
That is great, and I meant technically. After knowing it works and how it works then talking to BRL is the next step, I assume they are to bussy to help with the techincal matter. Perhaps they do not want us to discuss that in public?

However, you would not like the way you do it.
I fear you are right. Can you list what I need to know and do?

Chris, it explains how to get from C to max, is it the same if I have .i and .a files? Are they C files?

And to clearify point 5.
If someone could use a .i and .a file I create, will that file include everything requred by that module. For example the Max2D module?


Dreamora(Posted 2006) [#7]
No, bm does compile to ASM and use FASM (on windows). But it supports compiling C / C++ / ObjC / ASM code through import. All these generated object files then get linked together to a single application.

on 5) Yes that will include everything so you can sell / offer closed source modules to others. BUT all imported modules in your module must be present on the target BM installation or it will fail! (imported modules are not statically linked in case of modules)