Here is a simple example demonstrating the usage of libc.lib with Masm. This library comes with the free Visual C++ Toolkit 2003

.386
.model flat,stdcall
option casemap:none

include    \masm32\include\windows.inc
include    \masm32\include\kernel32.inc
include    \masm32\include\user32.inc
include    \masm32\include\masm32.inc

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib
includelib  \masm32\lib\masm32.lib
includelib  libc.lib ; CRT static library

strcat PROTO C :DWORD,:DWORD
strstr PROTO C :DWORD,:DWORD
strchr PROTO C :DWORD,:DWORD

.data
dest    db 'strcat example : ',0
        db 20 dup(0)
source  db 'Hello my friend',13,10,0
string2 db 'friend',0
crlf    db 13,10,0

.data?
buffer  db 20 dup(?)

.code

start:
invoke strcat,ADDR dest,ADDR source
invoke StdOut,ADDR dest
invoke strstr,ADDR dest,ADDR string2
call  print
invoke strchr,ADDR dest,114 ; look for 'r'
call  print
invoke ExitProcess,0

print  PROC
invoke dw2hex,eax,ADDR buffer
invoke StdOut,ADDR buffer
invoke StdOut,ADDR crlf
ret
print  ENDP

END start


Attachments:
Posted on 2005-11-19 14:26:45 by Vortex
Hi,Vortex
      Thanks for your post. I am just asking you a simple question

includelib  \masm32\lib\kernel32.lib
includelib  \masm32\lib\user32.lib
includelib  \masm32\lib\masm32.lib
includelib  libc.lib ; CRT static library
 
  It seems that you have set your lib path correctly.
  But I just set the path as the attachement in Radasm, and it does not work.
  I am using vs.net 2003 and radasm ,the current path is :
  D:\Microsoft Visual Studio.Net\Vc7\lib\libc.lib
  c:\radasm
  Would you please help me?
  Regards.
Attachments:
Posted on 2005-11-19 21:45:26 by Luckrock
Hi Luckrock,

RadASM , does it accept path names with spaces?

D:\Microsoft Visual Studio.Net\Vc7\lib\libc.lib


There are space characters between Microsoft & Visual / Visual & Studio

My trick was to copy libc.lib to my project folder. ( I know, this is not the best method )
Posted on 2005-11-20 03:14:55 by Vortex
It's a good idea to use C libray, but the problem is how to translate .h to .inc
We can do that by hand.
But if there is a program that can do such a chore will be appreciated by all of us.
Any one know what and where is the program that can translate *.h to *.inc ?
Posted on 2005-11-20 07:12:18 by guidry
Japheth's h2incx :

This tool's purpose is to convert C header files to MASM include files. It is much more powerful than Microsoft's h2inc tool. The main purpose is to convert the Win32 include files, but it should work with any C header files as well. It is a simple Win32 console application, but a 32bit DOS extended binary version is included as well to be used on Non-Win32 platforms.


http://www.japheth.de/h2incX.html
Posted on 2005-11-20 08:08:04 by Vortex
i posted an example of using libc.lib with masm in this thread, or directly this attachment.
it contains a custom made include file, and it was made with help of the great
h2incx by japheth. Many thanks to japheth for making this utility.
Posted on 2005-11-20 08:09:47 by drizz
Hi drizz,

Nice work.

Here is my own libc.inc for libc.lib from MS VC++ Toolkit 2003
Attachments:
Posted on 2005-11-20 08:24:44 by Vortex
hi,
  Thanks all
  You are all so great!
  Regards.
Posted on 2005-11-20 11:49:01 by Luckrock
Yes, that was what I always wanted.
Posted on 2005-11-20 18:08:42 by guidry