hi there,

i wanted to call standard c library functions like printf , ststr , etc directly from masm code. But the problem is that i dont have the inc/lib files for C runtimes.

any help will be highly appreciated :D

thanks in advance !
Posted on 2003-03-04 07:36:27 by himanshu
Posted on 2003-03-04 07:47:16 by roticv
so this should work with masm ????
Posted on 2003-03-04 07:59:25 by himanshu
Posted on 2003-03-04 08:15:02 by Vortex
btw who cares about masm anymore.FASM is delicious !!!!!
Posted on 2003-03-04 09:03:23 by himanshu

yet to importing from C libs, I'm writing this prototyp file self adding prototypes as needed, no prob with it, just to check how many args the func takes:

_strcmp proto C :DWORD, :DWORD


Does anybody know how to avoid RT error doing some calls to static library (eg printf etc..)..?
I guess there should be done some extra init as the CRTWinMain is overriden by asm (if I look at that it does some init surely - heap and more), no problem with runtime lib.

Posted on 2003-03-04 12:05:43 by _Servil_

so this should work with masm ????
btw who cares about masm anymore.FASM is delicious !!!!!

Himanshu,I think you are a bit confused. :)
Posted on 2003-03-05 01:52:47 by Vortex
Here is a quick example of using C library functions in asm.

.model flat,stdcall
option casemap:none

include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
includelib crtdll.lib

strcat PROTO C a1:DWORD,a2:DWORD

m1 db 'This is'
db 12 dup(0)
m2 db ' an example',0
format db '%s',0
invoke strcat,ADDR m1,ADDR m2
invoke printf,ADDR format,ADDR m1
invoke ExitProcess,0
end start

Posted on 2003-03-05 02:21:48 by Vortex
oh ,thanks man !
Posted on 2003-03-05 07:00:25 by himanshu
Himanshu,you are welcome. :)
Posted on 2003-03-05 08:15:21 by Vortex
i think i am going to like this cheerful board :D
winasm was never such fun !
Posted on 2003-03-05 10:04:41 by himanshu
Complier shoots out a fast program like a bullet.

There are brands of guns and compliers.

I like the feel and comfort of my gun, shoots the way I want it to.

So I'll stick to my M$ ml.6.14.8444.

That does not mean your gun does not kill a problem dead like mine, just, I like mine and you like yours.

Regards, P1
Posted on 2003-03-05 12:17:39 by Pone
hmmm... cant i just use the msvcrt.lib for importing C runtimes ??????
Posted on 2003-03-06 05:14:24 by himanshu
Yes,Himanshu you can use also the functions of msvcrt.dll


Posted on 2003-03-06 12:31:51 by Vortex