bindings/
mg_dlm__define.pro
includes main-level programClass representing a DLM made from a list of wrapper routines.
Examples
This example creates a DLM to access a few internal IDL routines, but this class could be used to access any C routines. The internal routines are:
char *IDL_OutputFormatFunc(int type)
int IDL_OutputFormatLenFunc(int type)
int IDL_TypeSizeFunc(int type)
char *IDL_TypeNameFunc(int type)
void IDL_TTYReset(void)
MG_DLM object with at least the BASENAME property:
f = mg_dlm(basename='format_example', $
name='FORMAT_EXAMPLE', $
description='Example of using dist_tools bindings', $
version='1.0', source='dist_tools')
f->addRoutineFromPrototype, 'char *IDL_OutputFormatFunc(int type)'
f->addRoutineFromPrototype, 'int IDL_OutputFormatLenFunc(int type)'
f->addRoutineFromPrototype, 'int IDL_TypeSizeFunc(int type)'
f->addRoutineFromPrototype, 'char *IDL_TypeNameFunc(int type)'
f->addRoutineFromPrototype, 'void IDL_TTYReset(void)'
addRoutinesFromHeaderFile method.
Next, a wrapper to access the value of a #define constant is also
created:
f->addPoundDefineAccessor, 'IDL_TYP_UNDEF', type=3L
write method writes the .c and .dlm files:
f->write
build method invokes the compiler and linker to make the shared
object file containing the wrappers:
f->build, /show_all_output
register method registers the DLM to be accessed in the current
IDL session:
f->register
MG_DLM object is no longer needed:
obj_destroy, f
IDL> .run mg_dlm__define
IDL> print, idl_outputformatfunc(5)
%#16.8g
IDL> print, idl_outputformatlenfunc(5)
16
IDL> print, idl_typesizefunc(5)
8
IDL> print, idl_typenamefunc(5)
DOUBLE
IDL> print, get_idl_typ_undef()
0
Class description for mg_dlm
Properties
- basename set
basename (including possible path) for
.cand.dlmfiles- _extra init
- source set
source in DLM header
- build_date set
date in DLM header
- name get set
name in DLM header
- version set
version in DLM header
- description set
description in DLM header
Routines
mg_dlm::setProperty, basename=basename, name=name, description=description, version=version, source=source, build_date=build_dateSet properties.
mg_dlm::getProperty, name=nameGet properties.
mg_dlm::writeWrites the .c and .dlm files to the BASENAME location.
mg_dlm::build [, _extra=keywords]Compiles and links the DLM.
mg_dlm::registerRegister the DLM.
mg_dlm::loadLoad the DLM.
mg_dlm::addInclude, name [, /system] [, header_directory=string] [, lib_directory=string] [, lib_files=strarr]Add an include file to the DLM.
mg_dlm::addRoutine, routineAdds a wrapper routine to the DLM.
mg_dlm::addRoutineFromPrototype, protoAdds a wrapper routine defined by a prototype given by a string to the DLM.
mg_dlm::addRoutinesFromHeaderFile, filenameAdds wrapper routines from a header file.
mg_dlm::addPoundDefineAccessor, name, type=longAdds wrapper routine to access the given #define value.
mg_dlm::cleanupFree resources.
result = mg_dlm::init(_extra=_extra)Create the DLM object.
mg_dlm__defineDefine instance variables.
Routine details
top source mg_dlm::setProperty
mg_dlm::setProperty, basename=basename, name=name, description=description, version=version, source=source, build_date=build_date
Set properties.
Keywords
- basename
basename (including possible path) for
.cand.dlmfiles- name
name in DLM header
- description
description in DLM header
- version
version in DLM header
- source
source in DLM header
- build_date
date in DLM header
top source mg_dlm::getProperty
mg_dlm::getProperty, name=name
Get properties.
Keywords
- name
name in DLM header
top source mg_dlm::build
mg_dlm::build [, _extra=keywords]
Compiles and links the DLM.
Keywords
- _extra in optional type=keywords
keywords to the
MG_MAKE_DLLroutine
top source mg_dlm::addInclude
mg_dlm::addInclude, name [, /system] [, header_directory=string] [, lib_directory=string] [, lib_files=strarr]
Add an include file to the DLM.
Parameters
- name in required type=string
name of the include file, including the .h
Keywords
- system in optional type=boolean
set to indicate that the include is a system include file, i.e., that there should be <>'s around the name instead of ""'s
- header_directory in optional type=string
filepath to include file, if not in a standard location
- lib_directory in optional type=string
directory of lib files
- lib_files in optional type=strarr
library files
top source mg_dlm::addRoutine
mg_dlm::addRoutine, routine
Adds a wrapper routine to the DLM.
Parameters
- routine in required type=routine object
routine object to add to the DLM
top source mg_dlm::addRoutineFromPrototype
mg_dlm::addRoutineFromPrototype, proto
Adds a wrapper routine defined by a prototype given by a string to the DLM.
Parameters
- proto in required type=string
prototype of the routine to add to the DLM
top source mg_dlm::addRoutinesFromHeaderFile
mg_dlm::addRoutinesFromHeaderFile, filename
Adds wrapper routines from a header file.
Parameters
- filename in required type=string
header filename
File attributes
| Modification date: | Thu May 17 10:39:22 2012 |
| Lines: | 633 |
| Docformat: | rst rst |
![[attach.png]](../idldoc-resources/attach.png)