How to create a library *PROPERLY* ?

I want to make a library for the later use with all other projects.
Let’s use zlib-1.2.1 as an example.

I need two versions of the library - register and stack.
So, I compile it with -4r and -4s respectively.
This will give me zlib3r.lib and zlib3s.lib respectively. I’ll symlink
them to /usr/lib.

But which of -mf|-ms flag should I use on library compilation to not have
problems with a project using that library, if I compile project with
either flag?

Should I worry about stack size (-N flag) during library
compilation?

Tony <mts.spb.suxx@mail.ru> wrote:

I want to make a library for the later use with all other projects.
Let’s use zlib-1.2.1 as an example.

But which of -mf|-ms flag should I use on library compilation to not have
problems with a project using that library, if I compile project with
either flag?

Use -ms.

A flat executable can be linked with small model or flat model objects,
a small model executable can only be (safely) linked with small
model objects.

(Basically, -mf says that the compiler may assume that source and
data segments are the same. -ms says to not assume this. If you
assume they’re not (-ms) and they happen to be so (link -mf) you
will still be ok.)

Should I worry about stack size (-N flag) during library
compilation?

No. Stack size is a program link relevant option only.

-David

David Gibbs
dagibbs@qnx.com