close
Warning:
Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.
- Timestamp:
-
Aug 2, 2010, 10:23:19 AM (15 years ago)
- Author:
-
Víctor de Buen Remiro
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v1
|
v2
|
|
1 | 1 | = Carga de librerías de enlace dinámico en TOL = |
| 2 | |
| 3 | La función built-in de TOL |
| 4 | |
| 5 | {{{ |
| 6 | NameBlock LoadDynLib(Text libraryPath) |
| 7 | }}} |
| 8 | |
| 9 | permite la carga de objetos y funciones creados en C++ para implementar tareas específicas que resulten demasiado lentas en TOL y no sean lo suficientemente generalizables como para formar parte de las utilidades globales del núcleo de TOL. Devuelve un NameBlock en lugar de objetos globales para poder mantener los requisitos de modularidad. |
| 10 | |
| 11 | == Uso dentro de paquetes == |
| 12 | |
| 13 | No es posible crear un paquete de forma directa pero sí se puede usar como un miembro dentro de un paquete, adjuntándolo como recurso externo e incluyendo la llamada dentro del método StartActions. |
| 14 | |
| 15 | {{{ |
| 16 | NameBlock MyPackage = |
| 17 | [[ |
| 18 | |
| 19 | ... |
| 20 | |
| 21 | NameBlock Tools = [[ Real _unused]]; |
| 22 | |
| 23 | ... |
| 24 | |
| 25 | Set _.autodoc.nonTolResources = { [[ |
| 26 | Set CrossPlatform = { [[ |
| 27 | Text cpp="cpp" |
| 28 | ]] } |
| 29 | |
| 30 | ... |
| 31 | |
| 32 | Real StartActions(Real void) |
| 33 | { |
| 34 | NameBlock Tools := LoadDynLib("cpp/tools.dll"); |
| 35 | |
| 36 | ... |
| 37 | |
| 38 | }; |
| 39 | ]]; |
| 40 | }}} |
| 41 | |
| 42 | == Creación de librerías de enlace dinámico en TOL == |
| 43 | |
| 44 | {{{ |
| 45 | #!cpp |
| 46 | /* |
| 47 | <NAME>.cpp |
| 48 | TOL Dynamic Library |
| 49 | Purpose: ... |
| 50 | */ |
| 51 | |
| 52 | #define LOCAL_NAMEBLOCK _local_nameblock_ |
| 53 | |
| 54 | static BUserNameBlock* _local_unb_ = new BGraContensP<BNameBlock>("", new BNameBlock); |
| 55 | static BNameBlock& _local_nameblock_ = _local_unb_ ->Contens(); |
| 56 | |
| 57 | //Entry point of library returns the NameBlock to LoadDynLib |
| 58 | //This is the only one exported function |
| 59 | BUserNameBlock* get_local_unb_<NAME>() |
| 60 | { |
| 61 | return(_local_unb_); |
| 62 | } |
| 63 | |
| 64 | //Internal operator declaration |
| 65 | DeclareContensClass(...) |
| 66 | DefIntOpr(...) |
| 67 | |
| 68 | //External operator declaration |
| 69 | DeclareContensClass(...) |
| 70 | DefExtOpr(...) |
| 71 | |
| 72 | //Member declaration |
| 73 | DeclareLocalMember(<TYPE>, <MEMBER_NAME>, <MEMBER_DESCRIPTION>, <MEMBER>) |
| 74 | |
| 75 | }}} |
| 76 | |