News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Complete msvcrt library and include file.

Started by hutch--, May 15, 2005, 05:44:07 AM

Previous topic - Next topic

GregL

#30
Vortex,

I gave your msvcrt.lib a try with my "64-bit Date and Time Functions" code and it works perfectly. I still don't see the difference between it and the masm32 msvcrt.lib. How is it better?

[Edit] Oops, I spoke too soon, I was accidentally linking the one from \masm32\lib. Here's what I get when I link to your msvcrt.lib. Same thing with Polink. What am I missing?

Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

/DEBUG
/SUBSYSTEM:CONSOLE
/INCREMENTAL:NO
/LIBPATH:D:\ASM\MASM32\Libraries\Vortex\Demo
test.obj : error LNK2001: unresolved external symbol __imp___ctime64
test.obj : error LNK2001: unresolved external symbol __imp___exit
test.obj : error LNK2001: unresolved external symbol __imp___ftime64
test.obj : error LNK2001: unresolved external symbol __imp___getch
test.obj : error LNK2001: unresolved external symbol __imp___gmtime64
test.obj : error LNK2001: unresolved external symbol __imp___localtime64
test.obj : error LNK2001: unresolved external symbol __imp___mktime64
test.obj : error LNK2001: unresolved external symbol __imp___strdate
test.obj : error LNK2001: unresolved external symbol __imp___strtime
test.obj : error LNK2001: unresolved external symbol __imp___time64
test.obj : error LNK2001: unresolved external symbol __imp___tzname
test.obj : error LNK2001: unresolved external symbol __imp___tzset
test.obj : error LNK2001: unresolved external symbol __imp__asctime
test.obj : error LNK2001: unresolved external symbol __imp__printf
test.obj : error LNK2001: unresolved external symbol __imp__strcpy
test.obj : error LNK2001: unresolved external symbol __imp__strftime
test.exe : fatal error LNK1120: 16 unresolved externals



GregL

Vortex,

I see, the masm32 msvcrt.inc isn't compatible. Sometimes a long break helps a lot.  :bg 

[Edit] _tzname isn't working correctly. It's late.


GregL


Vortex

Hi Greg,

You are right. I see that there are problems with the name of some functions. Visual C++ Express Edition compiles fine the code below :

#include <stdio.h>
#include <time.h>

int main(int argc,char *argv[])
{
_tzset();
printf( "_daylight = %d\n", _daylight );
printf( "_timezone = %ld\n", _timezone );
printf( "_tzname[0] = %s\n", _tzname[0] );
printf( "_tzname[1] = %s\n", _tzname[1] );
return 0;
}


Examining the assembly listing of this code, I noticed that some functions have extra underscores :

.
.
EXTRN ___tzname:PROC   ; 3 underscores
EXTRN ___timezone:PROC ; 3 underscores
EXTRN _printf:PROC
EXTRN ___daylight:PROC ; 3 underscores
EXTRN __tzset:PROC
.
.

Vortex

Here is the assembly listing :

; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.762

TITLE C:\PROGRA~1\VCEXPR~1\VC\dates.c
.686P
.XMM
include listing.inc
.model flat

INCLUDELIB LIBCMT
INCLUDELIB OLDNAMES

_DATA SEGMENT
$SG2556 DB '_daylight = %d', 0aH, 00H
$SG2557 DB '_timezone = %ld', 0aH, 00H
ORG $+3
$SG2558 DB '_tzname[0] = %s', 0aH, 00H
ORG $+3
$SG2559 DB '_tzname[1] = %s', 0aH, 00H
_DATA ENDS
PUBLIC _main
EXTRN ___tzname:PROC
EXTRN ___timezone:PROC
EXTRN _printf:PROC
EXTRN ___daylight:PROC
EXTRN __tzset:PROC
; Function compile flags: /Odtp
; File c:\program files\vcexpress\vc\dates.c
_TEXT SEGMENT
_argc$ = 8 ; size = 4
_argv$ = 12 ; size = 4
_main PROC

; 5    : {

push ebp
mov ebp, esp

; 6    : _tzset();

call __tzset

; 7    : printf( "_daylight = %d\n", _daylight );

call ___daylight
mov eax, DWORD PTR [eax]
push eax
push OFFSET $SG2556
call _printf
add esp, 8

; 8    : printf( "_timezone = %ld\n", _timezone );

call ___timezone
mov ecx, DWORD PTR [eax]
push ecx
push OFFSET $SG2557
call _printf
add esp, 8

; 9    : printf( "_tzname[0] = %s\n", _tzname[0] );

call ___tzname
mov edx, DWORD PTR [eax]
push edx
push OFFSET $SG2558
call _printf
add esp, 8

; 10   : printf( "_tzname[1] = %s\n", _tzname[1] );

call ___tzname
mov eax, DWORD PTR [eax+4]
push eax
push OFFSET $SG2559
call _printf
add esp, 8

; 11   : return 0;

xor eax, eax

; 12   : }

pop ebp
ret 0
_main ENDP
_TEXT ENDS
END

GregL

Vortex,

I'm seeing pretty much the same thing with Visual C++ 2008, I noticed you compiled with /MT, with Visual C++ 6.0 it's considerably different.


    TITLE   D:\C\Temp\VC6\test.c
    .386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT   SEGMENT PARA USE32 PUBLIC 'CODE'
_TEXT   ENDS
_DATA   SEGMENT DWORD USE32 PUBLIC 'DATA'
_DATA   ENDS
CONST   SEGMENT DWORD USE32 PUBLIC 'CONST'
CONST   ENDS
_BSS    SEGMENT DWORD USE32 PUBLIC 'BSS'
_BSS    ENDS
$$SYMBOLS   SEGMENT BYTE USE32 'DEBSYM'
$$SYMBOLS   ENDS
$$TYPES SEGMENT BYTE USE32 'DEBTYP'
$$TYPES ENDS
_TLS    SEGMENT DWORD USE32 PUBLIC 'TLS'
_TLS    ENDS
FLAT    GROUP _DATA, CONST, _BSS
    ASSUME  CS: FLAT, DS: FLAT, SS: FLAT
endif
PUBLIC  _main
EXTRN   __imp__printf:NEAR
EXTRN   __imp___daylight:DWORD
EXTRN   __imp___timezone:DWORD
EXTRN   __imp___tzname:QWORD
EXTRN   __imp___tzset:NEAR
_DATA   SEGMENT
$SG408  DB  '_daylight = %d', 0aH, 00H
$SG409  DB  '_timezone = %ld', 0aH, 00H
    ORG $+3
$SG410  DB  '_tzname[0] = %s', 0aH, 00H
    ORG $+3
$SG411  DB  '_tzname[1] = %s', 0aH, 00H
_DATA   ENDS
_TEXT   SEGMENT
_main   PROC NEAR
; File D:\C\Temp\VC6\test.c
; Line 5
    push    ebp
    mov ebp, esp
; Line 6
    call    DWORD PTR __imp___tzset
; Line 7
    mov eax, DWORD PTR __imp___daylight
    mov ecx, DWORD PTR [eax]
    push    ecx
    push    OFFSET FLAT:$SG408
    call    DWORD PTR __imp__printf
    add esp, 8
; Line 8
    mov edx, DWORD PTR __imp___timezone
    mov eax, DWORD PTR [edx]
    push    eax
    push    OFFSET FLAT:$SG409
    call    DWORD PTR __imp__printf
    add esp, 8
; Line 9
    mov ecx, DWORD PTR __imp___tzname
    mov edx, DWORD PTR [ecx]
    push    edx
    push    OFFSET FLAT:$SG410
    call    DWORD PTR __imp__printf
    add esp, 8
; Line 10
    mov eax, DWORD PTR __imp___tzname
    mov ecx, DWORD PTR [eax+4]
    push    ecx
    push    OFFSET FLAT:$SG411
    call    DWORD PTR __imp__printf
    add esp, 8
; Line 11
    xor eax, eax
; Line 12
    pop ebp
    ret 0
_main   ENDP
_TEXT   ENDS
END