Author:halw

Date:2009-01-14T05:38:12.000000Z


git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@162 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
halw
2009-01-14 05:38:12 +00:00
parent 8defe4bb0c
commit 7c808cf461
27 changed files with 169 additions and 124 deletions

View File

@@ -5,7 +5,7 @@ The syntax is pretty simple when you understand what you need to export a featur
===Syntax===
{|
{| border="1"
|-
| '''Export_feature'''
| Class_name [Creation_part] ":" Feature [Optional_part]
@@ -29,10 +29,11 @@ The syntax is pretty simple when you understand what you need to export a featur
===Example===
<code>ROOT_CLASS (make): foo @ 4 Alias my_foo call_type __stdcall</code>
<code lang=text>
ROOT_CLASS (make): foo @ 4 Alias my_foo call_type __stdcall</code>
===Constraint===
===Constraints===
<div>
* on the class: <div>The class cannot be deferred or generic.</div>
* on the feature: <div>It could be any feature except an attribute, an external feature or a deferred feature.</div>
@@ -47,7 +48,7 @@ For each feature the required fields are the '''class''', the '''creation proced
===A definition file===
<code>
<code lang=text>
-- EXPORTED FEATURE(s) OF THE SHARED LIBRARY
-- SYSTEM : demo

View File

@@ -1,38 +1,39 @@
[[Property:title|Dynamic library: Generated files]]
[[Property:weight|3]]
[[Property:uuid|f3926dd7-eb68-7a82-39f0-b4f5ea891436]]
Basically, 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 ''EIFGENs/target_name/W_code'' or ''EIFGENs/target_name/F_code'' directory.
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>EIFGENs/target_name/W_code</code> or <code>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:
<div>
* EIFGENs/target_name/W_code/'''system.def''' (or F_code)
* EIFGENs/target_name/W_code/'''edynlib.c''' (or F_code)
* $(ISE_EIFFEL)/studio/spec/$(ISE_PLATFORM)/templates/'''egc_dynlib.template''' <br/>
* <code>EIFGENs/target_name/W_code/</code>'''system.def''' (or F_code)
* <code>EIFGENs/target_name/W_code/</code>'''edynlib.c''' (or F_code)
* <code lang=text>$(ISE_EIFFEL)/studio/spec/$(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'''
* $(ISE_EIFFEL)/studio/spec/$(ISE_PLATFORM)/include/'''egc_dynlib.h'''
* <code lang=text>$(ISE_EIFFEL)/studio/spec/$(ISE_PLATFORM)/include/</code>'''egc_dynlib.h'''
* and the Makefile
</div>
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>LIBRARY demo.dll
<code lang=text>LIBRARY demo.dll
DESCRIPTION DEMO.DLL</code>
The following are EXPORTed functions.
<code>EXPORTS</code>
<code lang=text>
EXPORTS</code>
This part concerns the run-time. It initializes the run-time and reclaim Eiffel objects.
<code>
<code lang=text>
;System
init_rt
reclaim_rt
</code>
The exported for the BAR class:
<code>; CLASS [BAR]
<code lang=text>; CLASS [BAR]
get_string
print_bar
</code>
The exported for the ROOT_CLASS class:
<code>; CLASS [ROOT_CLASS]
<code lang=text>; CLASS [ROOT_CLASS]
make
foo
test_bar</code>

View File

@@ -1,11 +1,13 @@
[[Property:title|Dynamic library generation]]
[[Property:weight|-12]]
[[Property:uuid|201551d5-84af-f1ee-deed-b599d4f6e64a]]
* [[Dynamic library generation: Introduction|Introduction]]
* [[Dynamic library builder|Dynamic library builder]]
* [[Definition file|Definition file]]
* [[Dynamic library: Generated files|Generated files]]
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.