www.digitalmars.com         C & C++   DMDScript  

c++ - Problem using libs...

reply Eight <karl lil-voodoo.co.uk> writes:
Hi there,

I'm hoping some can help me here.

I'm trying to use DMC to compile a raw 16-bit binary (.com) for use in a
bootloader. To cut a very long story short, everything is coolio until I try
and use a function from the standard libraries. At which point I am greeted
with the message:
\lib\SDS.lib(c)
Error 42: Symbol Undefined _main

Of course, if I define it then the exe2bin conversion fails.

Is it not possible to use the standard libraries from .com objects? Or if it
is, can anyone give me a clue of how to go forward from this.

Many thanks.

8
Aug 17 2011
next sibling parent Eight <karl lil-voodoo.co.uk> writes:
Ack, forgot to add.

"#include <time.h>" or "#include <ctime>" works fine.

"time_t seconds;" appears to work fine.

But "seconds = time(NULL);" causes the error to appear.

I've tried this with a few different standard funcs, and the same behaviour
occurs. When a function is called, _main seems to become an issue.

Cheers.
Aug 17 2011
prev sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Eight wrote:
 I'm trying to use DMC to compile a raw 16-bit binary (.com) for use in a
 bootloader. To cut a very long story short, everything is coolio until I try
 and use a function from the standard libraries. At which point I am greeted
 with the message:
 \lib\SDS.lib(c)
 Error 42: Symbol Undefined _main
 
 Of course, if I define it then the exe2bin conversion fails.
 
 Is it not possible to use the standard libraries from .com objects? Or if it
 is, can anyone give me a clue of how to go forward from this.

first off, you do need a main() function. Second, conversion to .com fails if your code+data exceed 64K in size. So, I'd try starting with a trivial program first.
Aug 19 2011