Hello!

I'm new here and yesterday I have written my first assembler program... but I got a problem:

I wan't to use a function from the library msvcr70.dll which is used by VC7 programs. I have the correct LIB file (should be MSVCRT.LIB from the VC7 installation) and a correct include file. Here are some self written code snippets:

The include file MSVCRT.INC:


; ..\LIB\MSVCRT.LIB PROTOTYPES
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~

_strtoui64 PROTO :DWORD,:DWORD,:DWORD



Snippet of the function import:


.486
.model flat, stdcall
option casemap :none

include \masm32\include\windows.inc
include \masm32\include\msvcrt.inc

includelib \masm32\lib\msvcrt.lib

.data
szText BYTE "blablabla",0

[...]
invoke _strtoui64, OFFSET szText, NULL, 30
[...]


This is a snippet of the VC7 stdlib.h:


_CRTIMP unsigned __int64 __cdecl _strtoui64(const char *, char **, int);


I have copied the MSVCRT.LIB from VC7 into the directory MASM32\LIB. If I try to link it, I will get the following error:
blablabla.obj : error LNK2001: unresolved external symbol __strtoui64@12
blablabla.exe : fatal error LNK1120: 1 unresolved externals

The following code works fine:



push 30
push NULL
push OFFSET szText
call _strtoui64 ; DWORD with result of GetProcAddress
add esp, 0Ch


I want to include the function to my programm so it does no longer has to use the file msvcr70.dll...

BTW: I have read that MASM32 and VC6 uses the same LIB file format. Does VC7 uses another format?

Could somebody help me, please?

Greetings from Germany,
StarLord

PS: For my bad english I must apologize!
Posted on 2002-10-23 03:02:34 by StarLord
Oh dear... im so stupid! ;) I should only read the FAQ: I have to import the LIBC.LIB instead of the MSVCRT.LIB

BTW here is the _correct_ include file:



; ..\LIB\LIBC.LIB PROTOTYPES
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~

_strtoui64 PROTO [b]C[/b] :DWORD,:DWORD,:DWORD



I forgot to add the calling convention... and now it works. But why blows it my executable so up? 15 kByte more for a single function call? :confused:

Thanks for the great FAQ!

Greetings,
StarLord

:stupid:
Posted on 2002-10-23 05:47:28 by StarLord