|
When adding your own custom components to
ACIS, you may want the libraries to be available as shared/DLL. When using shared/DLL libraries, it is important to keep the order of libraries in mind. Functions from higher libraries can not be called from lower libraries.
|
|
|
The following steps should be done for each library that is to be built as a shared
ACIS library. An example (for Constructors or Intersectors libraries) is shown for most steps.
|
|
|
Note
|
The string <MODULE> should be substituted with the shared library module identifier listed in the Type column of the appropriate library table in section Libraries. The string <module> should be replaced with the lowercase version of this.
|
|
|
1.
|
Create a
dcl_<module>.h file in the library's directory.
|
|
|
This header file defines the
DECL_<MODULE> macro to indicate whether symbols are being exported or imported from the shared library. It also causes the library to be searched automatically by any file that includes this header on Windows systems.
|
|
|
#ifndef DECL_CSTR
|
|
#ifdef ACIS_DLL
|
|
# ifdef EXPORT_CSTR
|
|
#
|
define DECL_CSTR __declspec(dllexport)
|
|
# else
|
|
#
|
define DECL_CSTR __declspec(dllimport)
|
|
#
|
ifdef NT
|
|
#
|
|
pragma comment(lib, "constrct.lib") /*link library*/
|
|
#
|
endif
|
|
# endif
|
|
#else
|
|
# define DECL_CSTR
|
|
#endif
|
|
#endif
|
|
|
2.
|
Add a
MODULE command to the
config file in the library directory.
|
|
|
This tells the build tool the module name and include path for the
dcl_<module>.h file. It also tells the build tool that the library can be built as a shared/DLL library.
|
|
|
MODULE CSTR constrct/dcl_cstr.h
|
|
|
3.
|
Add a
DEFINE * EXPORT_<MODULE> command to the
config file in the library directory.
|
|
|
This causes the
dcl_<module>.h file to define
DECL_<MODULE> so that symbols are exported if
ACIS_DLL is defined.
|
|
|
DEFINE * EXPORT_CSTR
|
|
|
4.
|
Add a
LIB_DEPEND command to the
config file in the library directory.
|
|
|
This tells the build tool which libraries this library depends on, so it builds them in the correct order. The first library listed is the one being built, followed by those on which it depends.
|
|
|
LIB_DEPEND constrct intersct kernel spline
|
|
|
5.
|
Add the
DECL_<MODULE> modifier to declarations of classes, global variables and functions in header files.
|
|
|
This tells the compiler that the symbol should be exported when compiling files in the DLL and imported when compiling files outside the DLL.
|
|
|
DECL_CSTR outcome api_initialize_constructors();
|
|
class DECL_CSTR splgrid {
|
|
.
|
|
.
|
|
.
|
|
};
|
|
|
6.
|
Change definitions of
THIS_LIB and
PARENT_LIB to
<MODULE> instead of
NONE.
|
|
|
#define THIS() ATTRIB_INT
|
|
#define THIS_LIB INTR
|
|
#define PARENT() ATTRIB_BLND
|
|
#define PARENT_LIB KERN
|
|
|
7.
|
Change uses of the
MODULE_DEF,
MODULE_REF,
ENTITY_FUNCTIONS,
ATTRIB_FUNCTIONS,
MASTER_ENTITY_DECL,
MASTER_ATTRIB_DECL,
DISPATCH_DECL, and
LIST macros to specify
<MODULE> instead of
NONE.
|
|
|
#define MODULE() sg_check_wire
|
|
MODULE_DEF("sg_check_wire", CSTR);
|
|
|
8.
|
Include the
dcl_<module>.h file in any file which uses
DECL_<MODULE> or
<MODULE> as described above.
|
|
|
#include "constrct/dcl_cstr.h"
|
|
|
9.
|
Ensure that the header file that declares a symbol is included in the source file in which it is defined. Otherwise, you will get unresolved symbols when attempting to reference the symbol from outside the DLL.
|
|
|
These steps only make it possible to build the library as a shared/DLL library. The symbol
ACIS_DLL must be defined during compilation and special commands must be used to create the DLL or shared library instead of a static library. These items should already be handled by the architecture specific
config files in the
bldcfg directory.
|
|
|
Note
|
These steps are not required for UNIX platforms. Steps 2 and 4 tell the build tool to build as a shared library, if allowed, and are the only steps needed for shared libraries on UNIX platforms.
|