Pelles C forum

C language => Tips & tricks => Topic started by: Vortex on September 11, 2005, 12:58:54 pm

Title: Using Pelle's C run-time library with Masm
Post by: Vortex on September 11, 2005, 12:58:54 pm
Hi friends,

Here a simple Masm example using functions from Pelle's C run-time static library crt.lib :
Code: [Select]

.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  \pellesc\lib\crt.lib ; Pelle's 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
Title: Using Pelle's C run-time library with Masm
Post by: tomlau on October 26, 2006, 08:17:44 am
Great done, vortex!
I know you on the fasm forum, hoho.
Title: Using Pelle's C run-time library with Masm
Post by: Vortex on October 26, 2006, 07:17:04 pm
tomlau,

Thanks for your kind words. Yes, I am a member of Fasm forum.
Title: Re: Using Pelle's C run-time library with Masm
Post by: Grincheux on October 19, 2008, 05:58:17 pm
And of the Masm forum too