Appendix D Creating C Components


Generate C component files

To write a C component, you need these C component files. You compile these C component files (or C source files) into a DLL.

How method calls are made

The graphic below illustrates how Jaguar calls the DLL's functions in response to a component methdod invocation:

Figure 35-2: How a C component method is called

The sequence of events is:

  1. The client invokes a method using the proxy or stub appropriate to the type of client ("Client stub/proxy support" explains the different client types). The stub or proxy sends the invocation information over the network to the Jaguar server.
  2. The method skeleton in the method skeletons file unmarshals the call and makes another call to the method implementation in the method implementation template file.
  3. After the method executes, the method implementation returns the call to the method skeleton.
  4. The method skeleton marshals the call and sends the call to the client.

Procedure for generating C component files

To generate C component files from a package or component, start the Jaguar Manager and complete these tasks:

  1. Select the component or, if you want to generate files for all components in a package, select the package.
  2. Select File | Generate Stub/Skeleton. The Generate Stubs and Skeletons dialog is displayed.
  3. Select the Generate Skeletons check box. Unless you wish to generate stubs at the same time, deselect Generate Stubs. Enter values in the Skeletons Generation Options area as follows:
  4. Click Generate. Jaguar Manager generates a method implementation file name, and create and destroy routine templates appended with .new.
  5. Rename the generated method implementation template files, deleting .new.

File naming conventions

The component files are named according to this syntax:

file

file name

component skeleton

component-name.c

method prototypes

component-name.h

method implementation

method-name.c.new

create routine template

create.c.new

destroy routine template

destroy.c.new

where

component-name is the name of the component that you defined in Jaguar Manager.

method-name can be either of the following:

Jaguar Manager creates the directory structure based on the code base that you specify and the component name, as follows:

code_base/jcts_skel/component_name

where:

code_base is the directory name that you specify for the Code Base field in Jaguar Manager. If the specified value was not a full path, the directory will be located under the Jaguar installation directory, relative to the html/classes subdirectory.

component_name is the component name as displayed in Jaguar Manager.

Regenerate changed C component methods

When you add or delete methods or modify component method prototypes, you must regenerate the method skeletons and prototypes. You must manually add, delete, or modify the method in the implementation file. Before you regenerate the method skeletons and prototypes, move your modified implementation files to another directory or rename them so the new implementation template files do not overwrite your modified implementation files.

 


Copyright © 2000 Sybase, Inc. All rights reserved.