Article View: comp.os.os2.programmer
Article #29Re: C 32 bit and 16 bit DLL
From: Mark Alexander
Date: Wed, 28 Oct 1992 18:23
Date: Wed, 28 Oct 1992 18:23
25 lines
1773 bytes
1773 bytes
In article <1992Oct28.123801.188905@ipgaix.unipg.it> luca@dedalo.unipg.it (Luca Priorelli) writes: >Can anybody tell me if it is possible to call a 16 bit DLL from >a 32 bit application? Yes, if you have Watcom C-386, IBM C-Set/2, or the old MSC-386 from the early OS/2 2.0 SDK. You have to use the _far16 modifier when declaring the function, and use _far16 in the declarations of pointer parameters to the function (if any). For example: extern int _far16 funky(char _far16 *p); This causes the compiler to generate a 32-to-16-bit thunk and convert the pointer parameter when it sees a call to funky(). BC++ for OS/2 will support this feature. I don't know about emx, but I don't think it supports it directly in the compiler; if this is the case, you have to write your own wrapper functions in assembly language that do the necessary thunking and conversion. One way to find out how to do this is to look at the output of a compiler that does it automatically (warning: it's not a pretty sight). For more examples of 16-bit function prototypes, see BSESUB.H in the IBM toolkit. This header file contains prototypes for the VIO, KBD, and MOU subsystems, which are all 16-bit. I believe that wrappers for these functions are available for emx.
Technical Details
Message-ID:
<1992Oct28.182324.24886@genghis.borland.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!spool.mu.edu!decwrl!borland.com!alexandeReferences:
<1992Oct28.123801.188905@ipgaix.unipg.it>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.os2.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!darwin.sura.net!spool.mu.edu!decwrl!borland.com!alexande From: alexande@genghis.borland.com (Mark Alexander) Subject: Re: C 32 bit and 16 bit DLL Message-ID: <1992Oct28.182324.24886@genghis.borland.com> Originator: alexande@genghis.borland.com Sender: news@borland.com (News Admin) Organization: Borland International References: <1992Oct28.123801.188905@ipgaix.unipg.it> Date: Wed, 28 Oct 1992 18:23:24 GMT Lines: 25