diff --git a/api_loader.e b/api_loader.e
deleted file mode 100644
index eb9dd0bf..00000000
--- a/api_loader.e
+++ /dev/null
@@ -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
diff --git a/cURL.ecf b/cURL.ecf
index 6d7cbf65..9b3aae81 100644
--- a/cURL.ecf
+++ b/cURL.ecf
@@ -55,13 +55,8 @@
+
-
-
-
-
-
-
/spec$
diff --git a/curl_easy_externals.e b/curl_easy_externals.e
index 604177de..c91ced83 100644
--- a/curl_easy_externals.e
+++ b/curl_easy_externals.e
@@ -21,7 +21,7 @@ feature -- Command
local
l_api: POINTER
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
Result := c_init (l_api)
end
@@ -39,7 +39,7 @@ feature -- Command
l_api: POINTER
l_c_str: C_STRING
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
create l_c_str.make (a_string)
c_setopt (l_api, a_curl_handle, a_opt, l_c_str.item)
@@ -75,7 +75,7 @@ feature -- Command
local
l_api: POINTER
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
c_setopt_int (l_api, a_curl_handle, a_opt, a_curl_string.object_id)
end
@@ -89,7 +89,7 @@ feature -- Command
local
l_api: POINTER
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
c_setopt_int (l_api, a_curl_handle, a_opt, a_integer)
end
@@ -113,7 +113,7 @@ feature -- Command
local
l_api: POINTER
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
Result := c_perform (l_api, a_curl_handle)
end
@@ -128,7 +128,7 @@ feature -- Command
local
l_api: POINTER
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
c_cleanup (l_api, a_curl_handle)
end
@@ -156,7 +156,7 @@ feature -- Query
d: REAL_64
do
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 a_info & {CURL_INFO_CONSTANTS}.curlinfo_long /= 0 then
create mp.make ({PLATFORM}.integer_32_bytes)
@@ -186,7 +186,7 @@ feature -- Query
is_dynamic_library_exists: BOOLEAN
-- If dll/so files exist?
do
- Result := (api_loader.module_pointer (module_name) /= default_pointer)
+ Result := api_loader.is_interface_usable
end
feature -- Special setting
@@ -221,7 +221,7 @@ feature -- Special setting
local
l_api: POINTER
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
curl_function.c_set_write_function (l_api, a_curl_handle)
end
@@ -236,7 +236,7 @@ feature -- Special setting
local
l_api: POINTER
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
curl_function.c_set_read_function (l_api, a_curl_handle)
end
@@ -249,7 +249,7 @@ feature -- Special setting
local
l_api: POINTER
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
curl_function.c_set_progress_function (l_api, a_curl_handle)
end
@@ -262,7 +262,7 @@ feature -- Special setting
local
l_api: POINTER
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
curl_function.c_set_debug_function (l_api, a_curl_handle)
end
@@ -273,21 +273,13 @@ feature {NONE} -- Implementation
internal_curl_function: detachable CURL_FUNCTION
-- cURL functions.
- api_loader: API_LOADER
- -- API dynamic loader
- once
- create Result
- ensure
- not_void: Result /= Void
- end
-
- module_name: STRING
+ api_loader: DYNAMIC_MODULE
-- Module name.
local
l_utility: CURL_UTILITY
once
create l_utility
- Result := l_utility.module_name
+ Result := l_utility.api_loader
end
setopt_void_star (a_curl_handle: POINTER; a_opt: INTEGER; a_data:POINTER)
@@ -298,7 +290,7 @@ feature {NONE} -- Implementation
local
l_api: POINTER
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
c_setopt (l_api, a_curl_handle, a_opt, a_data)
end
diff --git a/curl_externals.e b/curl_externals.e
index b62eda7e..2474a36c 100644
--- a/curl_externals.e
+++ b/curl_externals.e
@@ -21,7 +21,7 @@ feature -- Command
local
l_ptr: POINTER
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
c_curl_global_init (l_ptr, {CURL_GLOBAL_CONSTANTS}.curl_global_all);
end
@@ -32,7 +32,7 @@ feature -- Command
local
l_ptr: POINTER
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
c_curl_global_cleanup (l_ptr);
end
@@ -74,7 +74,7 @@ feature -- Command
l_c_string: C_STRING
l_api: POINTER
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
create l_c_string.make (a_string)
Result := c_slist_append (l_api, a_list, l_c_string.item)
@@ -86,7 +86,7 @@ feature -- Query
is_dynamic_library_exists: BOOLEAN
-- If dll/so files exist?
do
- Result := (api_loader.module_pointer (module_name) /= default_pointer)
+ Result := api_loader.is_interface_usable
end
feature {CURL_FORM} -- Internal command
@@ -101,7 +101,7 @@ feature {CURL_FORM} -- Internal command
local
l_api: POINTER
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
c_formfree (l_api, a_curl_form)
end
@@ -109,21 +109,13 @@ feature {CURL_FORM} -- Internal command
feature {NONE} -- Implementation
- api_loader: API_LOADER
- -- API dynamic loader
- once
- create Result
- ensure
- not_void: Result /= Void
- end
-
- module_name: STRING
+ api_loader: DYNAMIC_MODULE
-- Module name.
local
l_utility: CURL_UTILITY
once
create l_utility
- Result := l_utility.module_name
+ Result := l_utility.api_loader
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)
@@ -132,7 +124,7 @@ feature {NONE} -- Implementation
l_c_string_1, l_c_string_2: C_STRING
l_api: POINTER
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
create l_c_string_1.make (a_arg_1_value)
create l_c_string_2.make (a_arg_2_value)
diff --git a/curl_utility.e b/curl_utility.e
index d00db8ad..941e822b 100644
--- a/curl_utility.e
+++ b/curl_utility.e
@@ -12,16 +12,26 @@ class
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.
once
- if {PLATFORM}.is_windows then
- Result := "libcurl.dll"
- elseif {PLATFORM}.is_mac then
- Result := "libcurl.3.dylib"
- else
- Result := "libcurl.so.3"
- end
+ Result := "libcurl"
ensure
not_void: Result /= Void
end
diff --git a/implementation/gtk/api_loader_imp.e b/implementation/gtk/api_loader_imp.e
deleted file mode 100644
index 766a3529..00000000
--- a/implementation/gtk/api_loader_imp.e
+++ /dev/null
@@ -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
diff --git a/implementation/mswin/api_loader_imp.e b/implementation/mswin/api_loader_imp.e
deleted file mode 100644
index adedd01a..00000000
--- a/implementation/mswin/api_loader_imp.e
+++ /dev/null
@@ -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 "
- 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 "
- 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