|
From: Frank K. <fbk...@co...> - 2003-11-21 07:58:50
|
David hgb wrote: > First sorry for the other reply... look a little extrange with digest > 14 ... etc. > > I only rereply for keep the correct thread ;). Hi David (and all), Hehe! I knew what you were replying to, but that *is* a problem with the "digest" option... > Ok, I am not sure, but I use a 'mechanism' that let me know if a > function is internal to the file, or is external. > > for example I use: > > def Wnd, 4 > and do: > invoke Wnd, [.x],[.y],[.z], [.k] > > and will be expanded some like > push dword [.k] > ... > call Wnd > > and if I do this: > invoke MessageBox, NULL, str, title, MB_OK > will be some like: > push dword MB_OK > ... > extern MessageBox > call [MessageBox] > > > The trick is that def, make(or define) a Wnd_internal or some like that, > then invoke check for see if is definied, in the other case is external > function. Yup, that'll work. > What about to use a %ifdef and %ifid ??? I couldn't get those to do what I want... > I dont understand the porpuose of if used ... what is the objetive??? :S ;) Well, the "fundamental" include file for the HLA library functions is just a list of all the functions, declared "extrn" - "extern" for Nasm of course. Apparently Masm is okay with this, and only "really" makes 'em "extern" if they appear in the file. Fasm, however, gives a bloated executable if you do this, and Nasm seems to do the same. For Fasm, the workaround is: if used foo extrn foo end if for every function in the library. I thought maybe "%ifid" would do it - the manual says "if it exists and is a valid identifier...". But I seem to get my "extern foo" whether it's used or not... I decided to instead try an approach like you describe. I didn't re-use "invoke" (HLA is Pascal order, I think), but tried to write a "hlacall" macro. At the moment it doesn't do any pushing of parameters, but I'll probably try to make it like "invoke" or "sys_..." (I'm really not a big fan of trying to make asm look like a HLL, but there are times when it makes sense). But first I gotta make it work at all... I think I'm getting "extern foo" where I want it. I don't think I'm getting multiple "extern foo"s if I call it more than once - and I guess that wouldn't do any harm anyway. But the linker isn't finding any of this stuff! Error messages as if I'd left the library path off entirely. I may need "extern FOO" or "_FOO" or something... (those seem not to work... haven't tried the "or something" yet...) I haven't spent much time on this - it isn't something I'm tremendously interested in doing - just something to fool with. There are a couple reasons why someone might want to link with the HLA library: it's a pretty nice library, AND it's been ported to Linux (ports to BSD, QNX, and maybe Solaris seem likely). So "portable" code can be written that just needs to be re-assembled and re-linked to run on another OS. Of course, you can do this by linking with the C library, too - Dr. Carter's tutorial uses this method. The HLA library would just be another option. > Nice day or night. Yeah... I can't tell the difference. Have a nice Now :) Best, Frank |