OWLNext 7.0
Borland's Object Windows Library for the modern age
|
Converting an ObjectWindows EXE OLE server to a DLL OLE server requires only a few modifications.
The following topics discuss the tasks involved with building a DLL OLE server.
The document registration tables of DLL servers must contain the serverctx key with the string value "Inproc." This allows ObjectComponents to register your application as a DLL server with OLE. EXE servers do not need to use the serverctx key since ObjectComponents defaults to EXE registration.
The following code illustrates the document registration structure of a DLL server. It comes from the sample Tic Tac Toe program in EXAMPLES/OWL/OCF/TTT.
You do not need to modify your application registration structure to convert your EXE server to a DLL server. It's a good idea, however, to use different clsid and progid values, especially if you intend to switch frequently from one type to the other. You can test for the BI_APP_DLL macro to declare a registration structure that works for both DLL and EXE servers; the macro is only defined when you are building a DLL. The following code shows a sample document registration which supplies two sets of progid and clsid values.
Notice that the debugger keys (debugger, debugprogid, and debugdesc) are not used when building a DLL server. They are relevant only when your server is an executable that a debugger can load.
ObjectWindows DLL servers must be compiled with the large memory model. They must be linked with the OLE, ObjectComponents, and ObjectWindows libraries. The integrated development environment (IDE) chooses the right build options for you when you select Dynamic Library for Target Type and request OWL and OCF support from the list of standard libraries. You may choose to link with the static or dynamic versions of the standard libraries.
To build an ObjectWindows DLL server from the command line, create a short makefile that includes the OWLOCFMK.GEN file found in the EXAMPLES subdirectory. Here, for example, is the makefile that builds the sample program Tic Tac Toe:
DLLRES holds the base name of your resource file and the final DLL name. OBJDLL holds the names of the object files from which to build the sample. Finally, your makefile should include the OWLOCFMK.GEN file.
Name your file MAKEFILE and type this at the command-line prompt:
Make, using instructions in OWLOCFMK.GEN, builds a new makefile tailored to your project. The command also runs the new makefile to build the program. If you change the command to define MODEL as d, the above command will create a new makefile and then build your DLL using the DLL version of the libraries instead of the large model static libraries.
For more information about how to use OWLOCFMK.GEN, read the instructions at the beginning of MAKEFILE.GEN, found in the examples directory.