Updated cURL library to use API wrapper library
Then removed useless classes such as {API_LOADER} {API_LOADER_IMP}, removed useless library references such as Vision2 and WEL
git-svn-id: https://svn.origo.ethz.ch/eiffelstudio/trunk/Src/library/cURL@78736 8089f293-4706-0410-a29e-feb5c42a2edf
This commit is contained in:
115
api_loader.e
115
api_loader.e
@@ -1,115 +0,0 @@
|
|||||||
note
|
|
||||||
description: "[
|
|
||||||
Dynamic load a external API which exists in a dll or so.
|
|
||||||
Benefit is we can still use our executables even without the dll/so files.
|
|
||||||
]"
|
|
||||||
status: "See notice at end of class."
|
|
||||||
legal: "See notice at end of class."
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
API_LOADER
|
|
||||||
|
|
||||||
feature -- Query
|
|
||||||
|
|
||||||
safe_load_api (a_module_name: STRING; a_api_name: STRING): POINTER
|
|
||||||
-- Safe loading `a_api_name' in `a_module_name' if possible.
|
|
||||||
-- `a_module_name' is case sensitive.
|
|
||||||
require
|
|
||||||
not_void: a_module_name /= Void and then not a_module_name.is_empty
|
|
||||||
not_void: a_api_name /= Void and then not a_api_name.is_empty
|
|
||||||
local
|
|
||||||
l_module: POINTER
|
|
||||||
do
|
|
||||||
l_module := module_pointer (a_module_name)
|
|
||||||
if l_module /= default_pointer then
|
|
||||||
Result := api_pointer (l_module, a_api_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
module_pointer (a_name: STRING): POINTER
|
|
||||||
-- Find module hanle with `a_name'
|
|
||||||
-- Result is void if not exists
|
|
||||||
require
|
|
||||||
not_void: a_name /= Void
|
|
||||||
do
|
|
||||||
if loaded_modules.has_key (a_name) then
|
|
||||||
Result := loaded_modules.item (a_name)
|
|
||||||
else
|
|
||||||
Result := implementation.load_module (a_name)
|
|
||||||
if Result /= default_pointer then
|
|
||||||
loaded_modules.extend (Result, a_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
api_pointer (a_module: POINTER; a_name: STRING): POINTER
|
|
||||||
-- Find API pointer which name is `a_name' in `a_module'
|
|
||||||
-- Result is void if not exists.
|
|
||||||
require
|
|
||||||
exists: a_module /= default_pointer
|
|
||||||
not_void: a_name /= Void
|
|
||||||
do
|
|
||||||
if loaded_apis.has (a_name) then
|
|
||||||
Result := loaded_apis.item (a_name)
|
|
||||||
else
|
|
||||||
Result := implementation.loal_api (a_module, a_name)
|
|
||||||
if Result /= default_pointer then
|
|
||||||
loaded_apis.extend (Result, a_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
|
||||||
|
|
||||||
loaded_modules: HASH_TABLE [POINTER, STRING]
|
|
||||||
-- Loaded modules
|
|
||||||
once
|
|
||||||
create Result.make (1)
|
|
||||||
end
|
|
||||||
|
|
||||||
loaded_apis: HASH_TABLE [POINTER, STRING]
|
|
||||||
-- Loaded apis.
|
|
||||||
once
|
|
||||||
create Result.make (10)
|
|
||||||
end
|
|
||||||
|
|
||||||
implementation: API_LOADER_IMP
|
|
||||||
-- Native loader
|
|
||||||
once
|
|
||||||
create Result
|
|
||||||
end
|
|
||||||
note
|
|
||||||
copyright: "Copyright (c) 1984-2007, Eiffel Software"
|
|
||||||
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
|
|
||||||
licensing_options: "http://www.eiffel.com/licensing"
|
|
||||||
copying: "[
|
|
||||||
This file is part of Eiffel Software's Eiffel Development Environment.
|
|
||||||
|
|
||||||
Eiffel Software's Eiffel Development Environment is free
|
|
||||||
software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License as published
|
|
||||||
by the Free Software Foundation, version 2 of the License
|
|
||||||
(available at the URL listed under "license" above).
|
|
||||||
|
|
||||||
Eiffel Software's Eiffel Development Environment is
|
|
||||||
distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty
|
|
||||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public
|
|
||||||
License along with Eiffel Software's Eiffel Development
|
|
||||||
Environment; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
]"
|
|
||||||
source: "[
|
|
||||||
Eiffel Software
|
|
||||||
356 Storke Road, Goleta, CA 93117 USA
|
|
||||||
Telephone 805-685-1006, Fax 805-685-6869
|
|
||||||
Website http://www.eiffel.com
|
|
||||||
Customer support http://support.eiffel.com
|
|
||||||
]"
|
|
||||||
|
|
||||||
end
|
|
||||||
7
cURL.ecf
7
cURL.ecf
@@ -55,13 +55,8 @@
|
|||||||
<dotnet value="true"/>
|
<dotnet value="true"/>
|
||||||
</condition>
|
</condition>
|
||||||
</external_object>
|
</external_object>
|
||||||
|
<library name="api_wrapper" location="$ISE_LIBRARY\library\api_wrapper\api_wrapper.ecf"/>
|
||||||
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
|
||||||
<library name="vision2" location="$ISE_LIBRARY\library\vision2\vision2.ecf">
|
|
||||||
<condition>
|
|
||||||
<platform excluded_value="windows"/>
|
|
||||||
</condition>
|
|
||||||
</library>
|
|
||||||
<library name="wel" location="$ISE_LIBRARY\library\wel\wel.ecf"/>
|
|
||||||
<cluster name="curl" location=".\" recursive="true">
|
<cluster name="curl" location=".\" recursive="true">
|
||||||
<file_rule>
|
<file_rule>
|
||||||
<exclude>/spec$</exclude>
|
<exclude>/spec$</exclude>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_init")
|
l_api := api_loader.api_pointer ("curl_easy_init")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
Result := c_init (l_api)
|
Result := c_init (l_api)
|
||||||
end
|
end
|
||||||
@@ -39,7 +39,7 @@ feature -- Command
|
|||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
l_c_str: C_STRING
|
l_c_str: C_STRING
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
create l_c_str.make (a_string)
|
create l_c_str.make (a_string)
|
||||||
c_setopt (l_api, a_curl_handle, a_opt, l_c_str.item)
|
c_setopt (l_api, a_curl_handle, a_opt, l_c_str.item)
|
||||||
@@ -75,7 +75,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
c_setopt_int (l_api, a_curl_handle, a_opt, a_curl_string.object_id)
|
c_setopt_int (l_api, a_curl_handle, a_opt, a_curl_string.object_id)
|
||||||
end
|
end
|
||||||
@@ -89,7 +89,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
c_setopt_int (l_api, a_curl_handle, a_opt, a_integer)
|
c_setopt_int (l_api, a_curl_handle, a_opt, a_integer)
|
||||||
end
|
end
|
||||||
@@ -113,7 +113,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_perform")
|
l_api := api_loader.api_pointer ("curl_easy_perform")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
Result := c_perform (l_api, a_curl_handle)
|
Result := c_perform (l_api, a_curl_handle)
|
||||||
end
|
end
|
||||||
@@ -128,7 +128,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_cleanup")
|
l_api := api_loader.api_pointer ("curl_easy_cleanup")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
c_cleanup (l_api, a_curl_handle)
|
c_cleanup (l_api, a_curl_handle)
|
||||||
end
|
end
|
||||||
@@ -156,7 +156,7 @@ feature -- Query
|
|||||||
d: REAL_64
|
d: REAL_64
|
||||||
do
|
do
|
||||||
a_data.replace (Void)
|
a_data.replace (Void)
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_getinfo")
|
l_api := api_loader.api_pointer ("curl_easy_getinfo")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
|
if a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
|
||||||
create mp.make ({PLATFORM}.integer_32_bytes)
|
create mp.make ({PLATFORM}.integer_32_bytes)
|
||||||
@@ -186,7 +186,7 @@ feature -- Query
|
|||||||
is_dynamic_library_exists: BOOLEAN
|
is_dynamic_library_exists: BOOLEAN
|
||||||
-- If dll/so files exist?
|
-- If dll/so files exist?
|
||||||
do
|
do
|
||||||
Result := (api_loader.module_pointer (module_name) /= default_pointer)
|
Result := api_loader.is_interface_usable
|
||||||
end
|
end
|
||||||
|
|
||||||
feature -- Special setting
|
feature -- Special setting
|
||||||
@@ -221,7 +221,7 @@ feature -- Special setting
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
curl_function.c_set_write_function (l_api, a_curl_handle)
|
curl_function.c_set_write_function (l_api, a_curl_handle)
|
||||||
end
|
end
|
||||||
@@ -236,7 +236,7 @@ feature -- Special setting
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
curl_function.c_set_read_function (l_api, a_curl_handle)
|
curl_function.c_set_read_function (l_api, a_curl_handle)
|
||||||
end
|
end
|
||||||
@@ -249,7 +249,7 @@ feature -- Special setting
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
curl_function.c_set_progress_function (l_api, a_curl_handle)
|
curl_function.c_set_progress_function (l_api, a_curl_handle)
|
||||||
end
|
end
|
||||||
@@ -262,7 +262,7 @@ feature -- Special setting
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
curl_function.c_set_debug_function (l_api, a_curl_handle)
|
curl_function.c_set_debug_function (l_api, a_curl_handle)
|
||||||
end
|
end
|
||||||
@@ -273,21 +273,13 @@ feature {NONE} -- Implementation
|
|||||||
internal_curl_function: detachable CURL_FUNCTION
|
internal_curl_function: detachable CURL_FUNCTION
|
||||||
-- cURL functions.
|
-- cURL functions.
|
||||||
|
|
||||||
api_loader: API_LOADER
|
api_loader: DYNAMIC_MODULE
|
||||||
-- API dynamic loader
|
|
||||||
once
|
|
||||||
create Result
|
|
||||||
ensure
|
|
||||||
not_void: Result /= Void
|
|
||||||
end
|
|
||||||
|
|
||||||
module_name: STRING
|
|
||||||
-- Module name.
|
-- Module name.
|
||||||
local
|
local
|
||||||
l_utility: CURL_UTILITY
|
l_utility: CURL_UTILITY
|
||||||
once
|
once
|
||||||
create l_utility
|
create l_utility
|
||||||
Result := l_utility.module_name
|
Result := l_utility.api_loader
|
||||||
end
|
end
|
||||||
|
|
||||||
setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER)
|
setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER)
|
||||||
@@ -298,7 +290,7 @@ feature {NONE} -- Implementation
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_easy_setopt")
|
l_api := api_loader.api_pointer ("curl_easy_setopt")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
c_setopt (l_api, a_curl_handle, a_opt, a_data)
|
c_setopt (l_api, a_curl_handle, a_opt, a_data)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_ptr: POINTER
|
l_ptr: POINTER
|
||||||
do
|
do
|
||||||
l_ptr := api_loader.safe_load_api (module_name, "curl_global_init")
|
l_ptr := api_loader.api_pointer ("curl_global_init")
|
||||||
if l_ptr /= default_pointer then
|
if l_ptr /= default_pointer then
|
||||||
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
|
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
|
||||||
end
|
end
|
||||||
@@ -32,7 +32,7 @@ feature -- Command
|
|||||||
local
|
local
|
||||||
l_ptr: POINTER
|
l_ptr: POINTER
|
||||||
do
|
do
|
||||||
l_ptr := api_loader.safe_load_api (module_name, "curl_global_cleanup")
|
l_ptr := api_loader.api_pointer ("curl_global_cleanup")
|
||||||
if l_ptr /= default_pointer then
|
if l_ptr /= default_pointer then
|
||||||
c_curl_global_cleanup (l_ptr);
|
c_curl_global_cleanup (l_ptr);
|
||||||
end
|
end
|
||||||
@@ -74,7 +74,7 @@ feature -- Command
|
|||||||
l_c_string: C_STRING
|
l_c_string: C_STRING
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_slist_append")
|
l_api := api_loader.api_pointer ("curl_slist_append")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
create l_c_string.make (a_string)
|
create l_c_string.make (a_string)
|
||||||
Result := c_slist_append (l_api, a_list, l_c_string.item)
|
Result := c_slist_append (l_api, a_list, l_c_string.item)
|
||||||
@@ -86,7 +86,7 @@ feature -- Query
|
|||||||
is_dynamic_library_exists: BOOLEAN
|
is_dynamic_library_exists: BOOLEAN
|
||||||
-- If dll/so files exist?
|
-- If dll/so files exist?
|
||||||
do
|
do
|
||||||
Result := (api_loader.module_pointer (module_name) /= default_pointer)
|
Result := api_loader.is_interface_usable
|
||||||
end
|
end
|
||||||
|
|
||||||
feature {CURL_FORM} -- Internal command
|
feature {CURL_FORM} -- Internal command
|
||||||
@@ -101,7 +101,7 @@ feature {CURL_FORM} -- Internal command
|
|||||||
local
|
local
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_formfree")
|
l_api := api_loader.api_pointer ("curl_formfree")
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
c_formfree (l_api, a_curl_form)
|
c_formfree (l_api, a_curl_form)
|
||||||
end
|
end
|
||||||
@@ -109,21 +109,13 @@ feature {CURL_FORM} -- Internal command
|
|||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
api_loader: API_LOADER
|
api_loader: DYNAMIC_MODULE
|
||||||
-- API dynamic loader
|
|
||||||
once
|
|
||||||
create Result
|
|
||||||
ensure
|
|
||||||
not_void: Result /= Void
|
|
||||||
end
|
|
||||||
|
|
||||||
module_name: STRING
|
|
||||||
-- Module name.
|
-- Module name.
|
||||||
local
|
local
|
||||||
l_utility: CURL_UTILITY
|
l_utility: CURL_UTILITY
|
||||||
once
|
once
|
||||||
create l_utility
|
create l_utility
|
||||||
Result := l_utility.module_name
|
Result := l_utility.api_loader
|
||||||
end
|
end
|
||||||
|
|
||||||
internal_formadd_string_string (a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: STRING_GENERAL; a_arg_3: INTEGER)
|
internal_formadd_string_string (a_form: TYPED_POINTER [POINTER]; a_last_pointer: TYPED_POINTER [POINTER]; a_arg_1: INTEGER; a_arg_1_value: STRING_GENERAL; a_arg_2: INTEGER; a_arg_2_value: STRING_GENERAL; a_arg_3: INTEGER)
|
||||||
@@ -132,7 +124,7 @@ feature {NONE} -- Implementation
|
|||||||
l_c_string_1, l_c_string_2: C_STRING
|
l_c_string_1, l_c_string_2: C_STRING
|
||||||
l_api: POINTER
|
l_api: POINTER
|
||||||
do
|
do
|
||||||
l_api := api_loader.safe_load_api (module_name, "curl_formadd");
|
l_api := api_loader.api_pointer ("curl_formadd");
|
||||||
if l_api /= default_pointer then
|
if l_api /= default_pointer then
|
||||||
create l_c_string_1.make (a_arg_1_value)
|
create l_c_string_1.make (a_arg_1_value)
|
||||||
create l_c_string_2.make (a_arg_2_value)
|
create l_c_string_2.make (a_arg_2_value)
|
||||||
|
|||||||
@@ -12,16 +12,26 @@ class
|
|||||||
|
|
||||||
feature -- Query
|
feature -- Query
|
||||||
|
|
||||||
|
api_loader: DYNAMIC_MODULE
|
||||||
|
-- API dynamic loader
|
||||||
|
local
|
||||||
|
l_platform: PLATFORM
|
||||||
|
once
|
||||||
|
create l_platform
|
||||||
|
if l_platform.is_unix or l_platform.is_mac then
|
||||||
|
create Result.make_with_version (module_name, "3")
|
||||||
|
else
|
||||||
|
check is_window: l_platform.is_windows end
|
||||||
|
create Result.make (module_name)
|
||||||
|
end
|
||||||
|
ensure
|
||||||
|
not_void: Result /= Void
|
||||||
|
end
|
||||||
|
|
||||||
module_name: STRING
|
module_name: STRING
|
||||||
-- Module name.
|
-- Module name.
|
||||||
once
|
once
|
||||||
if {PLATFORM}.is_windows then
|
Result := "libcurl"
|
||||||
Result := "libcurl.dll"
|
|
||||||
elseif {PLATFORM}.is_mac then
|
|
||||||
Result := "libcurl.3.dylib"
|
|
||||||
else
|
|
||||||
Result := "libcurl.so.3"
|
|
||||||
end
|
|
||||||
ensure
|
ensure
|
||||||
not_void: Result /= Void
|
not_void: Result /= Void
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,79 +0,0 @@
|
|||||||
note
|
|
||||||
description: "[
|
|
||||||
Interactive with native system APIs for dynamic loading.
|
|
||||||
GTK verson.
|
|
||||||
]"
|
|
||||||
status: "See notice at end of class."
|
|
||||||
legal: "See notice at end of class."
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
API_LOADER_IMP
|
|
||||||
|
|
||||||
feature -- Command
|
|
||||||
|
|
||||||
load_module (a_name: STRING): POINTER
|
|
||||||
-- Load module with `a_name'.
|
|
||||||
-- `a_name' is LPCTSTR, we should use WEL_STRING here.
|
|
||||||
require
|
|
||||||
exists: a_name /= Void
|
|
||||||
local
|
|
||||||
l_c_string: EV_GTK_C_STRING
|
|
||||||
do
|
|
||||||
l_c_string := a_name
|
|
||||||
Result := {EV_GTK_EXTERNALS}.g_module_open (l_c_string.item, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
loal_api (a_module: POINTER; a_name: STRING): POINTER
|
|
||||||
-- Load api which name is `a_name' in `a_module'
|
|
||||||
require
|
|
||||||
exists: a_module /= default_pointer
|
|
||||||
exists: a_name /= Void
|
|
||||||
local
|
|
||||||
l_c_string: EV_GTK_C_STRING
|
|
||||||
l_success: BOOLEAN
|
|
||||||
l_result: POINTER
|
|
||||||
do
|
|
||||||
if a_module /= default_pointer then
|
|
||||||
l_c_string := a_name
|
|
||||||
l_success := {EV_GTK_EXTERNALS}.g_module_symbol (a_module, l_c_string.item, $l_result)
|
|
||||||
if l_success then
|
|
||||||
Result := l_result
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
note
|
|
||||||
copyright: "Copyright (c) 1984-2007, Eiffel Software"
|
|
||||||
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
|
|
||||||
licensing_options: "http://www.eiffel.com/licensing"
|
|
||||||
copying: "[
|
|
||||||
This file is part of Eiffel Software's Eiffel Development Environment.
|
|
||||||
|
|
||||||
Eiffel Software's Eiffel Development Environment is free
|
|
||||||
software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License as published
|
|
||||||
by the Free Software Foundation, version 2 of the License
|
|
||||||
(available at the URL listed under "license" above).
|
|
||||||
|
|
||||||
Eiffel Software's Eiffel Development Environment is
|
|
||||||
distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty
|
|
||||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public
|
|
||||||
License along with Eiffel Software's Eiffel Development
|
|
||||||
Environment; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
]"
|
|
||||||
source: "[
|
|
||||||
Eiffel Software
|
|
||||||
356 Storke Road, Goleta, CA 93117 USA
|
|
||||||
Telephone 805-685-1006, Fax 805-685-6869
|
|
||||||
Website http://www.eiffel.com
|
|
||||||
Customer support http://support.eiffel.com
|
|
||||||
]"
|
|
||||||
|
|
||||||
end
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
note
|
|
||||||
description: "[
|
|
||||||
Interactive with native system APIs for dynamic loading.
|
|
||||||
Windows verson.
|
|
||||||
]"
|
|
||||||
status: "See notice at end of class."
|
|
||||||
legal: "See notice at end of class."
|
|
||||||
date: "$Date$"
|
|
||||||
revision: "$Revision$"
|
|
||||||
|
|
||||||
class
|
|
||||||
API_LOADER_IMP
|
|
||||||
|
|
||||||
feature -- Command
|
|
||||||
|
|
||||||
load_module (a_name: STRING): POINTER
|
|
||||||
-- Load module with `a_name'.
|
|
||||||
-- `a_name' is LPCTSTR, we should use WEL_STRING here.
|
|
||||||
require
|
|
||||||
exists: a_name /= Void
|
|
||||||
local
|
|
||||||
l_wel_string: WEL_STRING
|
|
||||||
do
|
|
||||||
create l_wel_string.make (a_name)
|
|
||||||
Result := c_load_module (l_wel_string.item)
|
|
||||||
end
|
|
||||||
|
|
||||||
loal_api (a_module: POINTER; a_name: STRING): POINTER
|
|
||||||
-- Load api which name is `a_name' in `a_module'
|
|
||||||
require
|
|
||||||
exists: a_module /= default_pointer
|
|
||||||
exists: a_name /= Void
|
|
||||||
local
|
|
||||||
l_c_string: C_STRING
|
|
||||||
do
|
|
||||||
create l_c_string.make (a_name)
|
|
||||||
Result := c_loal_api (a_module, l_c_string.item)
|
|
||||||
end
|
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
|
||||||
|
|
||||||
c_load_module (a_name: POINTER): POINTER
|
|
||||||
-- Load module with `a_name'.
|
|
||||||
-- `a_name' is LPCTSTR, we should use WEL_STRING here.
|
|
||||||
require
|
|
||||||
exists: a_name /= default_pointer
|
|
||||||
external
|
|
||||||
"C inline use <windows.h>"
|
|
||||||
alias
|
|
||||||
"return (EIF_POINTER) LoadLibrary ($a_name);"
|
|
||||||
end
|
|
||||||
|
|
||||||
c_loal_api (a_module: POINTER; a_name: POINTER): POINTER
|
|
||||||
-- Load api which name is `a_name' in `a_module'
|
|
||||||
require
|
|
||||||
exists: a_module /= default_pointer
|
|
||||||
exists: a_name /= default_pointer
|
|
||||||
external
|
|
||||||
"C inline use <windows.h>"
|
|
||||||
alias
|
|
||||||
"return GetProcAddress ((HMODULE) $a_module, $a_name);"
|
|
||||||
end
|
|
||||||
|
|
||||||
note
|
|
||||||
copyright: "Copyright (c) 1984-2007, Eiffel Software"
|
|
||||||
license: "GPL version 2 (see http://www.eiffel.com/licensing/gpl.txt)"
|
|
||||||
licensing_options: "http://www.eiffel.com/licensing"
|
|
||||||
copying: "[
|
|
||||||
This file is part of Eiffel Software's Eiffel Development Environment.
|
|
||||||
|
|
||||||
Eiffel Software's Eiffel Development Environment is free
|
|
||||||
software; you can redistribute it and/or modify it under
|
|
||||||
the terms of the GNU General Public License as published
|
|
||||||
by the Free Software Foundation, version 2 of the License
|
|
||||||
(available at the URL listed under "license" above).
|
|
||||||
|
|
||||||
Eiffel Software's Eiffel Development Environment is
|
|
||||||
distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty
|
|
||||||
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
See the GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public
|
|
||||||
License along with Eiffel Software's Eiffel Development
|
|
||||||
Environment; if not, write to the Free Software Foundation,
|
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
||||||
]"
|
|
||||||
source: "[
|
|
||||||
Eiffel Software
|
|
||||||
356 Storke Road, Goleta, CA 93117 USA
|
|
||||||
Telephone 805-685-1006, Fax 805-685-6869
|
|
||||||
Website http://www.eiffel.com
|
|
||||||
Customer support http://support.eiffel.com
|
|
||||||
]"
|
|
||||||
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user