[comp.windows.ms] Pointers to functions

mikael@vall.dsv.su.se (Mikael Kindborg) (10/09/89)

------
I have a question concerning the use of pointers to functions
in Windows programs. I want to have a program with mutiple
data segments. Must I use MakeProcInstance()? If I have to,
must I export the functions I want to refer to with pointers
in the .def file? I am developing an object-oriented framework
for Windows programs, and functions pointers are essential
to my system.

Mikael Kindborg
Department of Computer Science
University of Stockholm  Sweden

press@venice.SEDD.TRW.COM (Barry Press) (10/10/89)

You really raise two separate questions (as I understood the question) --
one related to multiple data segments, and one related to exporting fns.

You can avoid exporting functions (ANY functions) altogether by using a
program called FIXDS, which is available in the GEnie service, MS
roundtable, library 9 (I think).  What it does is change the prologue
to get the SS/DS value from SS, so exports to fixup how DS is known are
no longer needed.  It only works in apps, however, since DLL's run DS != SS.

Multiple data segments are another story altogether, usually found in
conjunction with large model.  As discussed here lately, the best answer is
don't do it -- allocate the memory you need dynamically from GlobalAlloc
instead.  If you must do it, all such data segments but the default should
be fixed.  It's been pointed out that the large commercial apps do not
need this.