mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-08 07:42:33 +01:00
Added release 19.05.
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@2152 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
[[Property:title|Definition file]]
|
||||
[[Property:weight|2]]
|
||||
[[Property:uuid|3a4b017c-ede1-7af1-2934-c7a28b303764]]
|
||||
The syntax is pretty simple when you understand what you need to export a feature: you need the name of the '''feature''', the name of the concerned '''class''', and the name of a '''creation procedure'''. What is optional is to specify an '''alias''', an '''index''' and a '''calling convention'''. The index and calling convention are mainly used to create a DLL for windows, and the alias to export the feature under a different name.
|
||||
|
||||
===Syntax===
|
||||
|
||||
{| border="1"
|
||||
|-
|
||||
| '''Export_feature'''
|
||||
| Class_name [Creation_part] ":" Feature [Optional_part]
|
||||
|-
|
||||
| '''Creation_part'''
|
||||
| "(" feature_name ")"
|
||||
|-
|
||||
| '''Optional_part'''
|
||||
| [Index_part] [Alias_part]
|
||||
|-
|
||||
| '''Index_part'''
|
||||
| "@" integer
|
||||
|-
|
||||
| '''Alias_part'''
|
||||
| "Alias" alias_name
|
||||
|-
|
||||
| '''Call_type_part'''
|
||||
| "call_type" call_type_name
|
||||
|}
|
||||
|
||||
|
||||
===Example===
|
||||
|
||||
<code lang=text>
|
||||
ROOT_CLASS (make): foo @ 4 Alias my_foo call_type __stdcall</code>
|
||||
|
||||
===Constraints===
|
||||
; on the class: The class cannot be deferred or generic.
|
||||
; on the feature: It could be any feature except an attribute, an external feature or a deferred feature.
|
||||
; on the creation procedure: It must have zero argument, and no return type.
|
||||
; on the alias name: It must be a valid name for a C function.
|
||||
; on the index: It must be strictly positive.
|
||||
; on the call type: It must be a valid call type for the targeted platform (useful for Windows only). For Visual C++, the valid calling conventions are __stdcall, __cdecl and __fastcall.
|
||||
|
||||
For each feature the required fields are the '''class''', the '''creation procedure''', and of course the '''feature''' itself.
|
||||
* If the feature is a creation procedure then do not specify any creation, it will use the feature as creation. For example '''ROOT_CLASS: make'''.
|
||||
* If the class has no creation procedure, do not specify any creation. default_create will be automatically used.
|
||||
|
||||
===A definition file===
|
||||
|
||||
<code lang=text>
|
||||
-- EXPORTED FEATURE(s) OF THE SHARED LIBRARY
|
||||
-- SYSTEM : demo
|
||||
|
||||
-- CLASS [BAR]
|
||||
-- Here get_string uses make_b as creation
|
||||
BAR (make_b) : get_string
|
||||
-- Here print_bar uses make_a as creation
|
||||
BAR (make_a) : print_bar
|
||||
|
||||
-- CLASS [ROOT_CLASS]
|
||||
-- Here the feature is also a creation
|
||||
ROOT_CLASS : make
|
||||
ROOT_CLASS (make) : foo
|
||||
ROOT_CLASS (make) : test_bar
|
||||
</code>
|
||||
@@ -0,0 +1,30 @@
|
||||
[[Property:title|Dynamic library builder]]
|
||||
[[Property:weight|1]]
|
||||
[[Property:uuid|e64cdcf2-6da1-98d5-8356-28b50d01374b]]
|
||||
In order to facilitate the creation of C dynamic libraries using EiffelStudio, a wizard helps generate the definition files used to define the contents of the shared library. If for some reason you need to override the wizard, the [[Definition file|syntactic rules]] of the definition files are available, but their knowledge is not necessary to use the generation of dynamic libraries in EiffelStudio.
|
||||
|
||||
The wizard is accessible in the '''Tools'''/ '''Dynamic library builder''' menu.
|
||||
|
||||
The dynamic library window that appears when selecting this menu is mainly composed of a list which contains all features that should be exported. This list is course empty at first.
|
||||
|
||||
[[Image:shared-library-window]]
|
||||
|
||||
{{note|The layout of this wizard is slightly different on Windows and on Unix systems, because the index and calling convention fields never appear on Unix systems. }}
|
||||
|
||||
To add a new feature to the definition file, you can either:
|
||||
* Pick the feature from any place in EiffelStudio and drop it into the list. If several creation procedures exists in the container class, a dialog is popped up to give the choice between all possible creation procedures.
|
||||
* Or, use the Add command [[Image:16x16--general-add-icon]] in the '''Edit'''/ '''Add''' menu. This pops up a dialog where it is possible to enter manually all parameters for the exported feature.
|
||||
|
||||
[[Image:new-exported-feature]]
|
||||
|
||||
Other commands of the '''Edit''' menu allow you to remove [[Image:16x16--general-delete-icon]] exported features or to modify their export parameters [[Image:16x16--general-edit-icon]] .
|
||||
|
||||
It is also possible to check the validity of the definition file. This command [[Image:view-unmodified-icon]] performs both a global check, to ensure that for example two features do not have the same name or same index in the library, and also local checks, that check for each feature that the parameters are valid.
|
||||
|
||||
Other commands, located in the '''File''' menu, give standard file operations, such as opening [[Image:general-open-icon]] a definition file, creating a new definition file [[Image:new-document-icon]] ,or saving the current definition file [[Image:16x16--general-save-icon]] .
|
||||
|
||||
{{tip|Although the wizard can handle several files during the same EiffelStudio session, remember that only one file can be used in the project settings to effectively generate a shared library. }}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
[[Property:title|Dynamic library: Generated files]]
|
||||
[[Property:weight|3]]
|
||||
[[Property:uuid|f3926dd7-eb68-7a82-39f0-b4f5ea891436]]
|
||||
Once the Eiffel definition file is created, the compiler will generate a set of files and will compile them to generate the Dynamic library into the <code lang="text">EIFGENs/target_name/W_code</code> or <code lang="text">EIFGENs/target_name/F_code</code> directory.
|
||||
|
||||
{{note|To generate and compile these files, you have to indicate the definition file that should be used in the [[Advanced Options|advanced node of the project settings]] of your system. This way EiffelStudio will know which one to use. If you do not specify any definition file, nothing will be generated. }}
|
||||
|
||||
The set of files is composed of:
|
||||
* <code lang="text">EIFGENs/target_name/W_code/</code>'''system.def''' (or F_code)
|
||||
* <code lang="text">EIFGENs/target_name/W_code/</code>'''edynlib.c''' (or F_code)
|
||||
* <code lang="text">$(ISE_EIFFEL)/studio/config/$(ISE_PLATFORM)/templates/</code>'''egc_dynlib.template''' <br/>
|
||||
this file will be copied during the compilation into the EIFGENs/target_name/W_code/E1 directory as '''egc_dynlib.c'''
|
||||
* <code lang="text">$(ISE_EIFFEL)/studio/spec/$(ISE_PLATFORM)/include/</code>'''egc_dynlib.h'''
|
||||
* and the Makefile
|
||||
|
||||
The ''system.def'' is only used on windows, it is the definition file used to generate a DLL when linking.<br/>
|
||||
Information about the DLL
|
||||
<code lang=text>LIBRARY demo.dll
|
||||
DESCRIPTION DEMO.DLL</code>
|
||||
The following are EXPORTed functions.
|
||||
<code lang=text>
|
||||
EXPORTS</code>
|
||||
This part concerns the run-time. It initializes the run-time and reclaim Eiffel objects.
|
||||
<code lang=text>
|
||||
;System
|
||||
init_rt
|
||||
reclaim_rt
|
||||
</code>
|
||||
The exported for the BAR class:
|
||||
<code lang=text>; CLASS [BAR]
|
||||
get_string
|
||||
print_bar
|
||||
</code>
|
||||
The exported for the ROOT_CLASS class:
|
||||
<code lang=text>; CLASS [ROOT_CLASS]
|
||||
make
|
||||
foo
|
||||
test_bar</code>
|
||||
|
||||
|
||||
The ''edynlib.c'' file is the interface between the Eiffel system and the C code. It contains the declaration and the implementation of the function used to directly call the eiffel feature with its real name.
|
||||
|
||||
The <span> ''egc_dynlib.c'' </span> and <span> ''egc_dynlib.h'' </span> files are used for operations performed by the run-time.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
[[Property:title|Dynamic library generation]]
|
||||
[[Property:weight|-12]]
|
||||
[[Property:uuid|201551d5-84af-f1ee-deed-b599d4f6e64a]]
|
||||
The Eiffel compiler offers the possibility to generate a '''dynamic shared library''' based on the system.
|
||||
|
||||
Thanks to this dynamic library, it is possible to call Eiffel features from a C program, by using the real names of the features.
|
||||
|
||||
In other words, the user can generate a DLL ''(*.dll)'' using features of the system on windows, and/or a shared library ''(*.so)'' on Unix.
|
||||
|
||||
For that, the user has first to describe what he wants to export in his dynamic library. This is done via a definition file ''(*.def)'', which specifies what features should be exported. A [[Dynamic library builder|wizard]] helps build the definition file, which makes this step very intuitive. The second step is to select the definition file in the [[Advanced Options|project settings]] to take this definition file into account. This done, the next compilation of the system will yield [[Dynamic library: Generated files|C files]] that can be used to create the shared library.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user