msvcrt.inc has the following type of defines

%define calling_convention_functionname_functioname

%define __cdecl_defined_wcsncpy _wcsncpy

I know there functions in the msvcrt.dll

How do i include my own functions that haven't been added to msvcrt.inc?
Also i notice there is also a msvcrt.lib file to go with that.
And has this format.
1152500062              100666  39        `  L^D     _wscanf msvcrt.dll
__imp__wscanf etc etc
      `
What exactly are these files are they prototypes so you don't make a mistaker calling the fucntion from the dll?
Ifd someone could explain this to me how i would go about adding my own fucntions it would be great.  `
I'm assuming masm and nasm don't differ much Im using nasm.
Thanks alot .
Posted on 2008-07-27 08:05:18 by gavin_
Before I begin - I apologise for this crude and simplistic answer. Its not the full story, but its close enough to give you an idea whats going on.

The INC file contains prototypes that describe the parameters of the functions, which can be used by the assembler to verify that you passed the right number and type of arguments.

The LIB file contains basically two kinds of information for those functions - it tells the linker which DLL to import the function from, or alternatively (for functions which are not actually imported from anywhere) it contains some inline code for 'bound' functions which get embedded directly in your binary target file (exe or dll).

The DLL contains essentially the same thing as the LIB file...
Basically, if you don't own the LIB file and want to use functions of a DLL, you have to call LoadLibrary and GetProcAddress and so on,which can get really annoying.

If you own the lib, you can hand it to the linker, which will shove some code and/or import imformation directly inside your exe, and that way you don't need to load that DLL yourself.
In fact, if all the functions you used are merely being imported into your DLL from some OTHER DLL, then the LIB-linked exe will work without your DLL, since the LIB told it exactly where to find the functions (example : __imp__wscanf is an IMPort, its not even inside msvcrt, it comes from somewhere ELSE ;))

Bottom line: you don't 'need' a LIB, but its nice to have it.

Posted on 2008-07-27 08:32:45 by Homer
Thats exactly the reply I wanted thanks for spending your time answering my question,much appriceated.
Posted on 2008-07-27 08:57:28 by gavin_

msvcrt.inc has the following type of defines

%define calling_convention_functionname_functioname

%define __cdecl_defined_wcsncpy _wcsncpy

I know there functions in the msvcrt.dll

How do i include my own functions that haven't been added to msvcrt.inc?
Also i notice there is also a msvcrt.lib file to go with that.
And has this format.
1152500062              100666  39        `  L^D      _wscanf msvcrt.dll
__imp__wscanf etc etc
       `
What exactly are these files are they prototypes so you don't make a mistaker calling the fucntion from the dll?
Ifd someone could explain this to me how i would go about adding my own fucntions it would be great.  `
I'm assuming masm and nasm don't differ much Im using nasm.
Thanks alot .


You should update your copy of NASMX, the inc files now use a macro called IMPORT which makes things a LOT easier. Also, the lib files are not used anymore as it uses GoLink for linking.
Posted on 2008-07-29 15:38:24 by Synfire