Re: libctiny.lib

From: George Hester (hesterloli_at_hotmail.com)
Date: 01/17/05


Date: Sun, 16 Jan 2005 22:21:10 -0500

I believe my command was to stop libc.lib from being called:

cl SimpleCalculator.c /link libctiny.lib /NODEFAULTLIB:libc.lib

Isn't that what is happening here? /NODEFAULTLIB:libc.lib

I tried it without trying to stop libc.lib from being called and errored with this:

Tried
cl /ML SimpleCalculator.c /link libctiny.lib
and
cl SimpleCalculator.c /link libctiny.lib libc.lib

got

libc.lib<crt0.obj) : error LNK2005: _mainCRTStartup already defined in libctiny.lib(CRT0TCON.OBJ)
SimpleCalculator.exe : fatal error LNK1169: one or more multiply defined symbols found

so then I tried to stop libc.lib from being called:

Tried:
cl SimpleCalculator.c /link libctiny.lib /NODEFAULTLIB:libc.lib

got

SimpleCalculator.obj : error LNK2001: unresolved external symbol _scanf
SimpleCalculator.obj : error LNK2001: unresolved external symbol _putchar
SimpleCalculator.obj : error LNK2001: unresolved external symbol _fltused

So that's why I asked.

Let me try:

cl SimpleCalculator.c /link libc.lib libctiny.lib

Fine but is 52KB. This is worthless. libc.lib alone gives that.

c/ SimpleCalculator.c link libctiny.lib libc.lib

libc.lib<crt0.obj) : error LNK2005: _mainCRTStartup already defined in libctiny.lib(CRT0TCON.OBJ)
SimpleCalculator.exe : fatal error LNK1169: one or more multiply defined symbols found

It doesn't seem to work at all. But thanks anyway.

-- 
George Hester
_________________________________
"Michael K. O'Neill" <mikeathon2000@nospam.hotmail.com> wrote in message news:egcjhRD$EHA.2112@TK2MSFTNGP14.phx.gbl...
> Here's a quote from the end of the article:
> 
> "You might be wondering about the runtime library routines that LIBCTINY
> doesn't implement. For instance, in TEST.CPP, there's a call to strrchr.
> There's no problem here because that function exists in the regular LIBC.LIB
> or LIBCMT.LIB that Visual C++ provides. Both LIBCTINY.LIB and LIBC.LIB
> implement a variety of routines. LIBCTINY's list is obviously smaller than
> what LIBC.LIB provides. The important thing for your purposes is that the
> linker finds the LIBCTINY routines first when resolving function calls, and
> so LIBCTINY's routines are what's used. If something isn't implemented in
> LIBCTINY, the linker finds it in LIBC.LIB instead."
> 
> It looks like you are linking to libc.lib too, so maybe you need to reverse
> the order of libc.lib and libctiny.lib in the command line
> 
> Mike
> 
> 
> 
> "George Hester" <hesterloli@hotmail.com> wrote in message
> news:OHSveW6%23EHA.4072@TK2MSFTNGP10.phx.gbl...
> Please take a look at this page:
> 
> http://msdn.microsoft.com/msdnmag/issues/01/01/hood/default.aspx
> 
> I made his libctiny.lib because I was aghast that this c program:
> 
> #define EOF -1
> #define PROMPT ':'
> #define exit return /* UNIX Fix */
> main(){
>  float a, b;
>  char opr;
>  float result;
>  while (putchar(PROMPT), scanf("%f%c%f", &a, &opr, &b) != EOF){ /* EOF =
> ctrl-z */
>   switch(opr){
>    case '+': result = a+b; break;
>    case '-': result = a-b; break;
>    case '*': result = a*b; break;
>    case '/': result = a/b; break;
>    default:
>     printf("ERROR **** illegal operator\n");
>     printf("Legal characters are +, -, * and /;");
>     printf(" Try again\n");
>     continue;
>   }
>   printf("result is %g\n", result);
>  }
>  printf("See ya");
>  exit(0);
> }
> 
> was 56KB.
> 
> But when I tried his libctiny.lib like this:
> 
> cl /o1 SimpleCalculator.c /link /NODEFAULT:libc.lib libctiny.lib
> 
> I got three errors:
> 
> SimpleCalculator.obj : error LNK2001: unresolved external symbol _scanf
> SimpleCalculator.obj : error LNK2001: unresolved external symbol _putchar
> SimpleCalculator.obj : error LNK2001: unresolved external symbol _fltused
> 
> What this tells me is his libctiny.lib is really tiny.  So tiny it doesn't
> have what is necessary for my program.  Is
> that right?
> 
> -- 
> George Hester
> _________________________________
> 
> 


Relevant Pages

  • Re: libctiny.lib
    ... "You might be wondering about the runtime library routines that LIBCTINY ... float result; ... SimpleCalculator.obj: error LNK2001: unresolved external symbol _putchar ...
    (microsoft.public.vc.language)
  • Re: Total beginners question
    ... use the Cache Explorer to import the routines, and the I use the Cache ... This is the first label, which is also the name of the ... command has no arguments. ... MUMPS programmers usually export these files at users' terminals back ...
    (comp.lang.mumps)
  • Re: Total beginners question
    ... use the Cache Explorer to import the routines, and the I use the Cache ... This is the first label, which is also the name of the ... command has no arguments. ... MUMPS programmers usually export these files at users' terminals back ...
    (comp.lang.mumps)
  • Re: Total beginners question
    ... Cache seems to be the "Unifier"? ... use the Cache Explorer to import the routines, and the I use the Cache ... command has no arguments. ... MUMPS programmers usually export these files at users' terminals back ...
    (comp.lang.mumps)
  • Re: GW Basic to VB6 help needed
    ... I use a menu and "chain" to the various basic routines. ... you may want to use Command buttons. ... Private Sub cmdRunProc_Click ...
    (microsoft.public.vb.controls)