summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-08 05:27:56 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-08 05:27:56 +0000
commit054d10048730f464b3ab144f196f090f843ae618 (patch)
tree142ba03f2b88e3680df993262ba5458d6c5d64ec
parent9a2c4be4f4d627fdc8385006b9aa3cde754bf2f8 (diff)
downloadATCD-054d10048730f464b3ab144f196f090f843ae618.tar.gz
Tue Jun 08 00:15:44 1999 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-99c7
-rw-r--r--TAO/examples/POA/Loader/Servant_Activator.cpp20
-rw-r--r--TAO/examples/POA/On_Demand_Loading/Servant_Manager.cpp51
3 files changed, 49 insertions, 29 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index 769ac4ac59c..bdf87cb9534 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,10 @@
+Tue Jun 08 00:15:44 1999 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * examples/POA/Loader/Servant_Activator.cpp (ServantActivator_i):
+ * examples/POA/On_Demand_Loading/Servant_Manager.cpp (obtain_servant):
+
+ Fixed void* to function pointer cast.
+
Tue Jun 8 00:19:02 1999 Fred Kuhns <fredk@cs.wustl.edu>
* Files modified: Acceptor_Registry.cpp, Acceptor_Registry.h,
diff --git a/TAO/examples/POA/Loader/Servant_Activator.cpp b/TAO/examples/POA/Loader/Servant_Activator.cpp
index db831d7a92e..26f79c5af61 100644
--- a/TAO/examples/POA/Loader/Servant_Activator.cpp
+++ b/TAO/examples/POA/Loader/Servant_Activator.cpp
@@ -38,17 +38,23 @@ ServantActivator_i::ServantActivator_i (CORBA::ORB_ptr orb,
"%p\n",
this->dll_.error ()));
+ // Obtain the symbol for the function that will get the servant
+ // object.
+
+ // Cannot go from void* to function pointer directly. Cast the void*
+ // to long first.
+ void *symbol = this->dll_.symbol (factory_function);
+ long function = ACE_reinterpret_cast (long, symbol);
- // Obtain the symbol for the function that will
- // get the servant object.
servant_supplier_ =
- (SERVANT_FACTORY) this->dll_.symbol (factory_function);
+ ACE_reinterpret_cast (SERVANT_FACTORY, function);
- // Obtain tne symbol for the function which
- // will destroy the servant.
+ // Obtain tne symbol for the function which will destroy the
+ // servant.
+ symbol = this->dll_.symbol (garbage_collection_function);
+ function = ACE_reinterpret_cast (long, symbol);
servant_garbage_collector_ =
- (SERVANT_GARBAGE_COLLECTOR) this->dll_.symbol (garbage_collection_function);
-
+ ACE_reinterpret_cast (SERVANT_GARBAGE_COLLECTOR, symbol);
}
// This method associates an servant with the ObjectID.
diff --git a/TAO/examples/POA/On_Demand_Loading/Servant_Manager.cpp b/TAO/examples/POA/On_Demand_Loading/Servant_Manager.cpp
index 3ffa8a7881e..5588e5f055c 100644
--- a/TAO/examples/POA/On_Demand_Loading/Servant_Manager.cpp
+++ b/TAO/examples/POA/On_Demand_Loading/Servant_Manager.cpp
@@ -21,9 +21,9 @@
ACE_RCSID(On_Demand_Activation, Servant_Manager, "$Id$")
-// Initialization.
-ServantManager_i::ServantManager_i (CORBA::ORB_ptr orb)
- : orb_ (CORBA::ORB::_duplicate (orb))
+ // Initialization.
+ ServantManager_i::ServantManager_i (CORBA::ORB_ptr orb)
+ : orb_ (CORBA::ORB::_duplicate (orb))
{
}
@@ -54,30 +54,36 @@ ServantManager_i::obtain_servant (const char *str,
// Obtain the ObjectId from the string argument.
- PortableServer::ObjectId_var oid =
- PortableServer::string_to_ObjectId (str);
+ PortableServer::ObjectId_var oid =
+ PortableServer::string_to_ObjectId (str);
- ACE_DEBUG ((LM_DEBUG,
- "before bind\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "before bind\n"));
// Make an HASH_MAP entry by binding the object_id and the DLL
// object associated with it together.
- if (this->servant_map_.bind (oid.in (),
- dll) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p\n",
- "Bind failed"),
- 0);
- // Now that the dll name is available we open the dll.
- if (dll->open (dllname_.c_str ()) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,
- "%p",
- dll->error ()),
- 0);
-
- // The next step is to obtain the symbol for the function that will
+ if (this->servant_map_.bind (oid.in (),
+ dll) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n",
+ "Bind failed"),
+ 0);
+ // Now that the dll name is available we open the dll.
+ if (dll->open (dllname_.c_str ()) == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p",
+ dll->error ()),
+ 0);
+
+ // The next step is to obtain the symbol for the function that will
// create the servant object and return it.
+
+ // Cannot go from void* to function pointer directly. Cast the void*
+ // to long first.
+ void *symbol = dll->symbol (create_symbol_.c_str ());
+ long function = ACE_reinterpret_cast (long, symbol);
+
SERVANT_FACTORY servant_creator =
- (SERVANT_FACTORY) dll->symbol (create_symbol_.c_str ());
+ ACE_reinterpret_cast (SERVANT_FACTORY, function);
// Checking whether it is possible to create the servant.
if (servant_creator == 0)
@@ -85,6 +91,7 @@ ServantManager_i::obtain_servant (const char *str,
"%p",
dll->error ()),
0);
+
// Now create and return the servant using the <servant_creator>
// factory function.
return (*servant_creator) (this->orb_.in (),