home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
VSCPPv8.zip
/
VACPP
/
IBMCPP
/
samples
/
COMPILER
/
SAMPLE04
/
READ.ME
< prev
next >
Wrap
Text File
|
1995-06-08
|
4KB
|
123 lines
SAMPLE04 - 32/16 SAMPLE
DESCRIPTION:
This sample program shows how to call 16-bit code from a 32-bit program, and
also how to call back to a 32-bit function from a 16-bit routine. The 16-bit
code is placed in two DLLs, one of which is bound to the 32-bit program at
load time by using IMPLIB to build an import library. The other is bound at
run time using OS/2 APIs.
TASK:
Prints a short poem.
FEATURE/CONCEPT:
Calling to and from 16-bit code.
PROJECT LOCATION:
Inside the COMPILER Sample folder (inside the VisualAge C++ for
OS/2 SAMPLES folder).
SOURCE FILE LOCATION:
X:\IBMCPP\SAMPLES\COMPILER\SAMPLE04
where X: is the drive you installed the samples and document component
of VisualAge C++ for OS/2.
HOW TO RUN THE SAMPLE:
- FROM WITHIN THE WorkFrame ENVIRONMENT
Open the Samples folder on your OS/2 desktop then double-click
on the project's icon to open the project view of the sample.
From the project menubar, select MONITOR then SHOW. Now click on the
RUN button on the project's toolbar.
- FROM THE COMMAND LINE
Simply type the name of the .EXE file, that is:
SAMPLE04
HOW TO BUILD THE SAMPLE PROJECT YOURSELF:
- FROM WITHIN THE WorkFrame ENVIRONMENT
Open the Samples folder on your OS/2 desktop then double-click on the
project's icon to open the project view of the sample. In the upper half
of the project window you will see the icons of the files associated with
the sample. From the Project pulldown, select BUILD -> REBUILD ALL. To
run the sample project, see HOW TO RUN THE SAMPLE above.
- FROM THE COMMAND LINE
A command file is provided to allow rebuilding of the WorkFrame projects
from the command line. Simply type:
BUILD
To run the sample project, see HOW TO RUN THE SAMPLE above.
SOFTWARE/HARDWARE PREREQUISITES:
IBM VisualAge C++
OS/2 2.1 or Warp
IBM or compatible 386 and up.
ADDITIONAL INFORMATION:
For more information on the creation and use of projects in the WorkFrame
environment, see the VisualAge C++ for OS/2 User's Guide.
For a complete listing and description of samples provided with the
VisualAge C++ for OS/2 product, see the VisualAge C++ for OS/2 Guide to
Samples.
Both books can be found online. To access an online book, simply open the
main VisualAge C++ desktop folder, then open the Information Folder inside.
To view a book, double-click on that book's icon.
The files for the sample program are:
READ.ME - This file.
BUILD.CMD - A command file to build the sample project from the
command line.
SAMPLE04.EXE - The sample's executable file.
SAMPLE04.C The source for the 32-bit main function:
- Makes direct calls to the 16-bit functions plugh1 and
plugh2, which are both defined in the 16-bit DLL bound
at load time. (See SAMP04A.C which contains the source
for plugh1 and plugh2.)
- Demonstrates a callback function. The 32-bit user function
xyzzy is passed to the 16-bit plugh3 routine (defined in
SAMP04A.C) with the intent that the 16-bit routine will
then call the user function. The xyzzy function is
declared using a 16-bit calling convention and is called
from the 16-bit DLL, but it is run as a 32-bit function.
- Uses OS/2 APIs to load the runtime DLL (the source for
which is SAMP04B.C) and query the address of the function
plugh4. The program then calls plugh4 using the function
pointer returned by the API.
SAMPLE04.H The user include file containing function prototypes for
the 16-bit functions.
16BIT\SAMP04A.C The source for functions plugh1, plugh2, and plugh3.
SAMP04A.DEF The module definition file for the first 16-bit DLL
SAMP04A.DLL The first 16-bit DLL (bound at load time).
16BIT\SAMP04B.C The source for function plugh4.
SAMP04B.DEF The module definition file for the second 16-bit DLL
SAMP04B.DLL The second 16-bit DLL (bound at run time).