Page 1 of 1

Borland C++ Object File

Posted: Sat May 20, 2006 8:15 am
by Tolga
Hi people.

I'm wondering that i have got Borland C++ 6.0. And it has got BCC32 file. With this, i'm compiling a c file. And it is creating an object file. (file.obj).

Question 1: Is this object file 32 bit?

Question 2: Can i use this object file for writing my kernel?

Thanks. ;)

Re:Borland C++ Object File

Posted: Sat May 20, 2006 8:31 am
by bluecode
1. Newer compiler don't support 16bit anymore. So most likely it is 32bit
2. Why not, if the file meets certain conditions: No external libraries that rely on os specific functions. And you should compile with the C compiler, because c++ requires additional supporting functions for some features (exception handling, rtti, new/delete, pure virtual functions)
Another thing is, that your bootloader has to support the executable format you choose for your kernel and the bootloader has to switch to 32bit protected-mode obviously :)

Re:Borland C++ Object File

Posted: Sat May 20, 2006 1:03 pm
by Midas
I don't know *anything* about Borland's C++ compiler, but there's a bit in the Wiki about doing kernels in C++ using G++, so if you were able to find Borland equivelants of the command-line arguments given here...

Doing a kernel in C++

Re:Borland C++ Object File

Posted: Sat May 20, 2006 2:26 pm
by mystran
It might be less work to just install gcc, than figure out how to do it with Borland...

If you want a nice GUI for gcc, I'm sure Dev-C++ can be configured for kernel development too. It comes with MinGW for Windows development (and MinGW is NOT a good idea for kernel stuff), but shouldn't be too hard to configure for another gcc (ELF enabled Cygwin?). Dev-C++ does support several compilers out of the box anyway.

I haven't tried yet myself, but I'm planning to, since I use Dev-C++ anyway for Windows stuff and it can happily use several compilers. That'd let me develop on a Windows box (instead of remote developing on my Linux box).

Dev-C++ isn't the most stable thing on the planet, but I haven't so far seen it crash so badly that it wouldn't let me save and restart without problems.

Re:Borland C++ Object File

Posted: Sun May 21, 2006 3:12 pm
by Tolga
I want to use Borland C++ for Intel Styled assembly. GCC is using AT&T styled assembly.

Problem: I compiled this code:

void main()
{
}

bcc32 kernel.cpp
Borland C++ created kernel.obj. But when i am using this file with ld linker. It is showing this error: File format not recognized.

What can i do?

Re:Borland C++ Object File

Posted: Sun May 21, 2006 11:21 pm
by crackers
Well If thats ld from borland package I'ld say It's rather strange unless you've changed object file format in compiler and did'nt inform linker about it.
Maybe you will find something here
http://edmulroy.portbridge.com/howto.htm or here
http://info.borland.com/techpubs/bcppbu ... s/pro.html
I had similar problem to you - don't like AT&T- so I'm writing most of may asm code in seperate files and use NASM which is similar to Intel notation.

Re:Borland C++ Object File

Posted: Mon May 22, 2006 4:37 am
by ineo
Tolga wrote: I want to use Borland C++ for Intel Styled assembly. GCC is using AT&T styled assembly.
Assembly style isn't an issue since you can choose AT&T or Intel style syntax using a gas directive .intel_syntax ... Just don't forget the .att_syntax at the end of your code as gcc expect this.

More information here.

Of course as you are coding you may choose whatever you want ;) But keep it mind that alternatives exists.