954,496 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Link c++ and asm

I have a asm boot on a floppy disc and i want to show a c++ kernel (cuz c++ are easy). but how can i link it? I heared somethig about : extern _main call _main for asm. Can anyone help me? :'(

vedel
Newbie Poster
12 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

If you have a boot loader and you want it to execute a c program then the boot loader can't just simply use the call statement to do it. Your boot load will have to first load the c program into memory and then start executing it at the beginning of the program, which will normally NOT be main(). C compilers add a lot of code to the beginning of the program, and the last thing that startup code does is call main().

Ancient Dragon
Retired & Loving It
Team Colleague
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
 

If this is a custom environment then you'll probably have to create a special linking/compiling process so your exe will execute.

In truth I'm not really sure what your after? The boot floppy, is it one you created or is it one you downloaded? The kernel I have the same questions, is it one you created or is it one you downloaded?

gerard4143
Nearly a Posting Maven
2,272 posts since Jan 2008
Reputation Points: 512
Solved Threads: 387
 

If this is a custom environment then you'll probably have to create a special linking/compiling process so your exe will execute.

In truth I'm not really sure what your after? The boot floppy, is it one you created or is it one you downloaded? The kernel I have the same questions, is it one you created or is it one you downloaded?

i dont have a kernel yet... but i wrote my own bootloader (very simple bootloader) and i have a USB floppy drive

vedel
Newbie Poster
12 posts since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: