Can someone give me an example of a .asm file that properly assembles and links into a valid .lib file?
Thanks!
Posted on 2001-12-02 07:25:47 by LOLTH
Hi,

this is a simple skeleton example:

mylib.asm:
.386
.model flat, stdcall

MyFunc PROTO
.code
MyFunc proc

ret
MyFunc endp
end


to compile:
ml /c /Cp /coff mylib.asm
lib mylib.obj /out:mylib.lib


mylib.inc:
MyFunc PROTO


clip
Posted on 2001-12-02 08:18:43 by clip
don't you need a .code in there as well? And shouldn't "MyFunc PROTO"
be "MyFunc PROC"?
Posted on 2001-12-02 12:07:17 by f0dder
Could someone tell me what is wrong with the attached .lib file? it was compiled from the included .asm file, so you can see the souce. It follows clip's and masm32's suggestions on the format for a .lib, but when i try to includelib it, the linker gives me a
"fatal error L1104: dosio.lib: Not a Valid Library"
I dont see why...
Posted on 2001-12-02 17:21:14 by LOLTH
On the surface, your code looks fine... untill you dig a little deeper and see what your actually trying to do. Im not positive of weather or not you can do what your trying (didnt compile it, just looked at it).

What i see is:

    [*]Your got 3 lib funcitons, written in 16bit mode with 32 bit overides.
    [*]Your behavior uses 16bit dos interupts (ie int 16), and also has some segment overides to ES:[],xx. These are fine in 16 bit dos stuff, but in generall, not very fine at all in a windows 32 bit environment.
    [*]numout expects a 32 bit parameter, which implies you might be using these with windows. ??? . If you are trying to do this then you definitely will not get anything to work. In general, nothing is stopping you from having a 32 bit param, but you still can only act on the 32 bit data to and from 16 sources. (Not windows 9x etc)


    Well i dont even know what your doing, or what the focus of the problem your having is, but these are some possible problem areas that i can see from a once over...

    Hope it helps..
    :alright:
    NaN
Posted on 2001-12-02 17:53:58 by NaN
I am sorry for not being clearer. I tested these functions in .asm form, but wish to put them in lib form, because libraries are more efficient. The contents of the functions doesnt matter, they could just be blank, but i want to know why they do not make a valid library. All of the functions are written for dos (hence the name, dosio), i would not dream of running them under windows. The external output to 0b800h is the location in dos memory of the screen memory. It is just a fast way of writing to the dos screen. The problem is not with the contents of the functions, but with the way they are put together into libraries. Thanks for the help though;)
Posted on 2001-12-02 18:31:45 by LOLTH
LOLTH,

Your problem is trying to use libraries from DOS that absolutely will not work in 32 bit PE files. Even if you could get the libraries to work, the DOS interrupts would crash 32 bit windows code.

MASM32 code uses libraries in the standard 32 bit Microsoft format so the examples are multiple and easy enough to find.

What you will have to do if you are trying to get the functionality of old DOS programs is to rewrite the interrupt code into windows API code.

Good luck with it.

hutch@movsd.com
Posted on 2001-12-02 18:37:12 by hutch--
LOLTH, if you want to use .lib under dos:

- You must not use /coff switch to ml.exe

- you will need to get 16bit versions of lib.exe and the linker.
I think 16bit linker expects the library in OMF LIB format, not
AR (unix-style, adopted by windows) LIB format.
Posted on 2001-12-02 19:37:42 by f0dder
Ok, i got it working
Thanks, everyone!:)
Posted on 2001-12-02 20:39:25 by LOLTH
LOLTH,

If you're doing stuff in a DOS box, then you're kool with INTs. But if you're doing a "true" windows program, you should know that while 95/98/ME may let you "get away with" using some INTs, you will be screwed if you try it on NT/2K/XP.

To me, it pays to do it once, and do it so it works anywhere. XP may mark the end of the 9x shell. Just a reminder... :)
Posted on 2001-12-02 22:31:01 by S/390
f0dder:

don't you need a .code in there as well? And shouldn't "MyFunc PROTO" be "MyFunc PROC"?


huh? it has a .code, and it works normal.
Posted on 2001-12-03 09:17:43 by clip
Heh clip, sorry. That's what happens when I look at stuff after 16
hours of being awake ;).
Posted on 2001-12-03 10:56:37 by f0dder
f0dder:

it's alright, well that happens to me too heh.
Posted on 2001-12-04 10:03:40 by clip