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
Hi,Vortex
Thanks for your post. I am just asking you a simple question
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.
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.
Hi Luckrock,
RadASM , does it accept path names with spaces?
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 )
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 )
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 ?
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 ?
Japheth's h2incx :
http://www.japheth.de/h2incX.html
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
Hi drizz,
Nice work.
Here is my own libc.inc for libc.lib from MS VC++ Toolkit 2003
Nice work.
Here is my own libc.inc for libc.lib from MS VC++ Toolkit 2003
hi,
Thanks all
You are all so great!
Regards.
Thanks all
You are all so great!
Regards.
Yes, that was what I always wanted.