[ofa-general] [PATCH 1/2 rev2] uDAT/uDAPL v2 - (master branch) changes to sync common code base with WinOF 1.01

Arlin Davis arlin.r.davis at intel.com
Tue Dec 11 10:25:27 PST 2007


 
>> -    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
>> -				    &dapl_ia_handle);
>> +    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
>
>For consistency with your change above, should the cast 
>be changed to 
>
>+    dat_status = dats_get_ia_handle((DAT_IA_HANDLE)ia_handle, 
>&dapl_ia_handle);
>

Good catch. I missed some dat_api.c changes from Stan. Here is rev2. 

  - add DAT_API to specify calling conventions (windows=__stdcall, linux= ) 
  - cleanup platform specific definitions for windows
  - c++ support
  - add handle check macros DAT_IA_HANDLE_TO_UL and UL_TO_DAT_IA_HANDLE

Signed-off by: Arlin Davis <ardavis at ichips.intel.com>
Signed-off by: Stan Smith <stan.smith at intel.com>

diff --git a/dat/common/dat_api.c b/dat/common/dat_api.c
index 1415f73..c882319 100755
--- a/dat/common/dat_api.c
+++ b/dat/common/dat_api.c
@@ -57,7 +57,7 @@
 typedef struct 
 {
     DAT_OS_LOCK     handle_lock;
-    int	            handle_max;
+    unsigned long   handle_max;
     void            **handle_array;
 } DAT_HANDLE_VEC;
 
@@ -78,7 +78,7 @@ DAT_RETURN
 dats_handle_vector_init ( void )
 {
     DAT_RETURN		dat_status;
-    int			i;
+    unsigned long	i;
 
     dat_status = DAT_SUCCESS;
 
@@ -113,12 +113,12 @@ dats_handle_vector_init ( void )
  * Install an ia_handle into a handle vector and return a small
  * integer.
  ***********************************************************************/
-unsigned long
+DAT_IA_HANDLE
 dats_set_ia_handle (
 	IN  DAT_IA_HANDLE		ia_handle )
 {   
-    unsigned long   i;
-    void 	   **h;
+    unsigned long	i;
+    void		**h;
 
     dat_os_lock (&g_hv.handle_lock);
 
@@ -135,7 +135,7 @@ dats_set_ia_handle (
             
 	    dat_os_dbg_print (DAT_OS_DBG_TYPE_PROVIDER_API,
 			      "dat_set_handle %p to %d\n", ia_handle, i);
-	    return (unsigned long) i;
+	    return UL_TO_DAT_IA_HANDLE(i);
 	}
     }
 
@@ -149,7 +149,7 @@ dats_set_ia_handle (
     if (h == NULL)
     {
 	dat_os_unlock (&g_hv.handle_lock);
-	return -1;
+	return UL_TO_DAT_IA_HANDLE(-1);
     }
     /* copy old data to new area & free old memory*/
     memcpy((void *)h, (void *)g_hv.handle_array, sizeof(void *) * g_hv.handle_max);
@@ -169,8 +169,7 @@ dats_set_ia_handle (
     dat_os_dbg_print (DAT_OS_DBG_TYPE_PROVIDER_API,
 		      "dat_set_handle x %p to %d\n", ia_handle, i);
 
-    return (unsigned long) i;
-
+    return UL_TO_DAT_IA_HANDLE(i);
 }
 
 /***********************************************************************
@@ -180,17 +179,17 @@ dats_set_ia_handle (
  ***********************************************************************/
 DAT_RETURN
 dats_get_ia_handle(
-	IN  unsigned long		handle,
+	IN  DAT_IA_HANDLE 		handle,
 	OUT DAT_IA_HANDLE		*ia_handle_p )
 {
     DAT_RETURN		dat_status;
 
-    if (handle > g_hv.handle_max)
+    if (DAT_IA_HANDLE_TO_UL(handle) > g_hv.handle_max)
     {
 	dat_status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
 	goto bail;
     }
-    *ia_handle_p = g_hv.handle_array[handle];
+    *ia_handle_p = g_hv.handle_array[DAT_IA_HANDLE_TO_UL(handle)];
 
     if (*ia_handle_p == NULL)
     {
@@ -226,7 +225,7 @@ DAT_RETURN
 dats_is_ia_handle (
 	IN  DAT_HANDLE			dat_handle)
 {
-    unsigned long handle = (unsigned long) dat_handle;
+    unsigned long handle = DAT_IA_HANDLE_TO_UL((DAT_IA_HANDLE)dat_handle);
 
     if (g_hv.handle_max < handle )
     {
@@ -250,16 +249,16 @@ dats_is_ia_handle (
  ***********************************************************************/
 DAT_RETURN
 dats_free_ia_handle (
-	IN  unsigned long		handle)
+	IN  DAT_IA_HANDLE		handle)
 {
     DAT_RETURN		dat_status;
 
-    if (handle > g_hv.handle_max)
+    if (DAT_IA_HANDLE_TO_UL(handle) > g_hv.handle_max)
     {
 	dat_status = DAT_ERROR(DAT_INVALID_HANDLE, DAT_INVALID_HANDLE_IA);
 	goto bail;
     }
-    g_hv.handle_array[handle] = NULL;
+    g_hv.handle_array[DAT_IA_HANDLE_TO_UL(handle)] = NULL;
     dat_status = DAT_SUCCESS;
 
     dat_os_dbg_print (DAT_OS_DBG_TYPE_PROVIDER_API,
@@ -272,7 +271,7 @@ dats_free_ia_handle (
 /**********************************************************************
  * API definitions for common API entry points
  **********************************************************************/
-DAT_RETURN dat_ia_query (
+DAT_RETURN DAT_API dat_ia_query (
 	IN      DAT_IA_HANDLE		ia_handle,
 	OUT     DAT_EVD_HANDLE		*async_evd_handle,
 	IN      DAT_IA_ATTR_MASK	ia_attr_mask,
@@ -283,8 +282,7 @@ DAT_RETURN dat_ia_query (
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_IA_QUERY (dapl_ia_handle,
@@ -298,7 +296,7 @@ DAT_RETURN dat_ia_query (
     return dat_status;
 }
 
-DAT_RETURN dat_set_consumer_context (
+DAT_RETURN DAT_API dat_set_consumer_context (
 	IN      DAT_HANDLE		dat_handle,
 	IN      DAT_CONTEXT		context)
 {
@@ -307,8 +305,8 @@ DAT_RETURN dat_set_consumer_context (
         DAT_IA_HANDLE   dapl_ia_handle;
         DAT_RETURN      dat_status;
 
-        dat_status = dats_get_ia_handle((unsigned long)dat_handle,
-                                        &dapl_ia_handle);
+        dat_status = dats_get_ia_handle((DAT_IA_HANDLE)dat_handle,
+					&dapl_ia_handle);
         
         /* failure to map the handle is unlikely but possible */
         /* in a mult-threaded environment                     */
@@ -325,7 +323,7 @@ DAT_RETURN dat_set_consumer_context (
 }
 
 
-DAT_RETURN dat_get_consumer_context (
+DAT_RETURN DAT_API dat_get_consumer_context (
 	IN      DAT_HANDLE		dat_handle,
 	OUT     DAT_CONTEXT		*context)
 {
@@ -334,7 +332,7 @@ DAT_RETURN dat_get_consumer_context (
         DAT_IA_HANDLE   dapl_ia_handle;
         DAT_RETURN      dat_status;
 
-        dat_status = dats_get_ia_handle((unsigned long)dat_handle,
+        dat_status = dats_get_ia_handle((DAT_IA_HANDLE)dat_handle,
                                         &dapl_ia_handle);
 
         /* failure to map the handle is unlikely but possible */
@@ -352,7 +350,7 @@ DAT_RETURN dat_get_consumer_context (
 }
 
 
-DAT_RETURN dat_get_handle_type (
+DAT_RETURN DAT_API dat_get_handle_type (
 	IN      DAT_HANDLE		dat_handle,
 	OUT     DAT_HANDLE_TYPE		*type)
 {
@@ -361,7 +359,7 @@ DAT_RETURN dat_get_handle_type (
         DAT_IA_HANDLE   dapl_ia_handle;
         DAT_RETURN      dat_status;
 
-        dat_status = dats_get_ia_handle((unsigned long)dat_handle,
+        dat_status = dats_get_ia_handle((DAT_IA_HANDLE)dat_handle,
                                         &dapl_ia_handle);
 
         /* failure to map the handle is unlikely but possible */
@@ -374,12 +372,11 @@ DAT_RETURN dat_get_handle_type (
         dat_handle = dapl_ia_handle;
     }
 
-    return DAT_GET_HANDLE_TYPE (dat_handle,
-				type);
+    return DAT_GET_HANDLE_TYPE (dat_handle, type);
 }
 
 
-DAT_RETURN dat_cr_query (
+DAT_RETURN DAT_API dat_cr_query (
 	IN      DAT_CR_HANDLE		cr_handle,
 	IN      DAT_CR_PARAM_MASK	cr_param_mask,
 	OUT     DAT_CR_PARAM		*cr_param)
@@ -394,7 +391,7 @@ DAT_RETURN dat_cr_query (
 }
 
 
-DAT_RETURN dat_cr_accept (
+DAT_RETURN DAT_API dat_cr_accept (
 	IN      DAT_CR_HANDLE		cr_handle,
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_COUNT		private_data_size,
@@ -411,7 +408,7 @@ DAT_RETURN dat_cr_accept (
 }
 
 
-DAT_RETURN dat_cr_reject (
+DAT_RETURN DAT_API dat_cr_reject (
 	IN      DAT_CR_HANDLE 		cr_handle,
 	IN	DAT_COUNT		private_data_size,
 	IN const DAT_PVOID		private_data)
@@ -424,7 +421,7 @@ DAT_RETURN dat_cr_reject (
 }
 
 
-DAT_RETURN dat_evd_resize (
+DAT_RETURN DAT_API dat_evd_resize (
 	IN      DAT_EVD_HANDLE		evd_handle,
 	IN      DAT_COUNT		evd_min_qlen)
 {
@@ -437,7 +434,7 @@ DAT_RETURN dat_evd_resize (
 }
 
 
-DAT_RETURN dat_evd_post_se (
+DAT_RETURN DAT_API dat_evd_post_se (
 	IN      DAT_EVD_HANDLE	       evd_handle,
 	IN      const DAT_EVENT		*event)
 {
@@ -450,7 +447,7 @@ DAT_RETURN dat_evd_post_se (
 }
 
 
-DAT_RETURN dat_evd_dequeue (
+DAT_RETURN DAT_API dat_evd_dequeue (
 	IN      DAT_EVD_HANDLE		evd_handle,
 	OUT     DAT_EVENT		*event)
 {
@@ -463,7 +460,7 @@ DAT_RETURN dat_evd_dequeue (
 }
 
 
-DAT_RETURN dat_evd_free (
+DAT_RETURN DAT_API dat_evd_free (
 	IN      DAT_EVD_HANDLE 		evd_handle)
 {
     if (evd_handle == NULL)
@@ -473,7 +470,7 @@ DAT_RETURN dat_evd_free (
     return DAT_EVD_FREE (evd_handle);
 }
 
-DAT_RETURN dat_evd_query (
+DAT_RETURN DAT_API dat_evd_query (
 	IN      DAT_EVD_HANDLE		evd_handle,
 	IN      DAT_EVD_PARAM_MASK	evd_param_mask,
 	OUT     DAT_EVD_PARAM		*evd_param)
@@ -488,7 +485,7 @@ DAT_RETURN dat_evd_query (
 }
 
 
-DAT_RETURN dat_ep_create (
+DAT_RETURN DAT_API dat_ep_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	IN      DAT_PZ_HANDLE		pz_handle,
 	IN      DAT_EVD_HANDLE		recv_completion_evd_handle,
@@ -500,8 +497,7 @@ DAT_RETURN dat_ep_create (
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status =  DAT_EP_CREATE (dapl_ia_handle,
@@ -517,7 +513,7 @@ DAT_RETURN dat_ep_create (
 }
 
 
-DAT_RETURN dat_ep_query (
+DAT_RETURN DAT_API dat_ep_query (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_EP_PARAM_MASK	ep_param_mask,
 	OUT     DAT_EP_PARAM		*ep_param)
@@ -532,7 +528,7 @@ DAT_RETURN dat_ep_query (
 }
 
 
-DAT_RETURN dat_ep_modify (
+DAT_RETURN DAT_API dat_ep_modify (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_EP_PARAM_MASK	ep_param_mask,
 	IN      const DAT_EP_PARAM 	*ep_param)
@@ -546,7 +542,7 @@ DAT_RETURN dat_ep_modify (
 			  ep_param);
 }
 
-DAT_RETURN dat_ep_connect (
+DAT_RETURN DAT_API dat_ep_connect (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_IA_ADDRESS_PTR	remote_ia_address,
 	IN      DAT_CONN_QUAL		remote_conn_qual,
@@ -570,7 +566,7 @@ DAT_RETURN dat_ep_connect (
 			   connect_flags);
 }
 
-DAT_RETURN dat_ep_common_connect (
+DAT_RETURN DAT_API dat_ep_common_connect (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_IA_ADDRESS_PTR	remote_ia_address,
 	IN      DAT_TIMEOUT		timeout,
@@ -588,7 +584,7 @@ DAT_RETURN dat_ep_common_connect (
 			   private_data);
 }
 
-DAT_RETURN dat_ep_dup_connect (
+DAT_RETURN DAT_API dat_ep_dup_connect (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_EP_HANDLE		ep_dup_handle,
 	IN      DAT_TIMEOUT		timeout,
@@ -609,7 +605,7 @@ DAT_RETURN dat_ep_dup_connect (
 }
 
 
-DAT_RETURN dat_ep_disconnect (
+DAT_RETURN DAT_API dat_ep_disconnect (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_CLOSE_FLAGS		close_flags)
 {
@@ -621,7 +617,7 @@ DAT_RETURN dat_ep_disconnect (
 			      close_flags);
 }
 
-DAT_RETURN dat_ep_post_send (
+DAT_RETURN DAT_API dat_ep_post_send (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_COUNT		num_segments,
 	IN      DAT_LMR_TRIPLET		*local_iov,
@@ -639,7 +635,7 @@ DAT_RETURN dat_ep_post_send (
 			     completion_flags);
 }
 
-DAT_RETURN dat_ep_post_send_with_invalidate (
+DAT_RETURN DAT_API dat_ep_post_send_with_invalidate (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_COUNT		num_segments,
 	IN      DAT_LMR_TRIPLET		*local_iov,
@@ -661,7 +657,7 @@ DAT_RETURN dat_ep_post_send_with_invalidate (
 			     rmr_context);
 }
 
-DAT_RETURN dat_ep_post_recv (
+DAT_RETURN DAT_API dat_ep_post_recv (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_COUNT		num_segments,
 	IN      DAT_LMR_TRIPLET		*local_iov,
@@ -680,7 +676,7 @@ DAT_RETURN dat_ep_post_recv (
 }
 
 
-DAT_RETURN dat_ep_post_rdma_read (
+DAT_RETURN DAT_API dat_ep_post_rdma_read (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_COUNT		num_segments,
 	IN      DAT_LMR_TRIPLET		*local_iov,
@@ -701,7 +697,7 @@ DAT_RETURN dat_ep_post_rdma_read (
 }
 
 
-DAT_RETURN dat_ep_post_rdma_read_to_rmr (
+DAT_RETURN DAT_API dat_ep_post_rdma_read_to_rmr (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      const DAT_RMR_TRIPLET	*local_iov,
 	IN      DAT_DTO_COOKIE		user_cookie,
@@ -720,7 +716,7 @@ DAT_RETURN dat_ep_post_rdma_read_to_rmr (
 }
 
 
-DAT_RETURN dat_ep_post_rdma_write (
+DAT_RETURN DAT_API dat_ep_post_rdma_write (
 	IN      DAT_EP_HANDLE		ep_handle,
 	IN      DAT_COUNT		num_segments,
 	IN      DAT_LMR_TRIPLET		*local_iov,
@@ -741,7 +737,7 @@ DAT_RETURN dat_ep_post_rdma_write (
 }
 
 
-DAT_RETURN dat_ep_get_status (
+DAT_RETURN DAT_API dat_ep_get_status (
 	IN      DAT_EP_HANDLE		ep_handle,
 	OUT     DAT_EP_STATE		*ep_state,
 	OUT     DAT_BOOLEAN 		*recv_idle,
@@ -758,7 +754,7 @@ DAT_RETURN dat_ep_get_status (
 }
 
 
-DAT_RETURN dat_ep_free (
+DAT_RETURN DAT_API dat_ep_free (
 	IN      DAT_EP_HANDLE		ep_handle)
 {
     if (ep_handle == NULL)
@@ -769,7 +765,7 @@ DAT_RETURN dat_ep_free (
 }
 
 
-DAT_RETURN dat_ep_reset (
+DAT_RETURN DAT_API dat_ep_reset (
 	IN      DAT_EP_HANDLE		ep_handle)
 {
     if (ep_handle == NULL)
@@ -780,7 +776,7 @@ DAT_RETURN dat_ep_reset (
 }
 
 
-DAT_RETURN dat_lmr_free (
+DAT_RETURN DAT_API dat_lmr_free (
 	IN      DAT_LMR_HANDLE		lmr_handle)
 {
     if (lmr_handle == NULL)
@@ -791,7 +787,7 @@ DAT_RETURN dat_lmr_free (
 }
 
 
-DAT_RETURN dat_rmr_create (
+DAT_RETURN DAT_API dat_rmr_create (
 	IN      DAT_PZ_HANDLE		pz_handle,
 	OUT     DAT_RMR_HANDLE		*rmr_handle)
 {
@@ -804,7 +800,7 @@ DAT_RETURN dat_rmr_create (
 }
 
 
-DAT_RETURN dat_rmr_create_for_ep (
+DAT_RETURN DAT_API dat_rmr_create_for_ep (
 	IN      DAT_PZ_HANDLE		pz_handle,
 	OUT     DAT_RMR_HANDLE		*rmr_handle)
 {
@@ -815,7 +811,7 @@ DAT_RETURN dat_rmr_create_for_ep (
     return DAT_RMR_CREATE_FOR_EP (pz_handle,
 			   rmr_handle);
 }
-DAT_RETURN dat_rmr_query (
+DAT_RETURN DAT_API dat_rmr_query (
 	IN      DAT_RMR_HANDLE		rmr_handle,
 	IN      DAT_RMR_PARAM_MASK	rmr_param_mask,
 	OUT     DAT_RMR_PARAM		*rmr_param)
@@ -830,7 +826,7 @@ DAT_RETURN dat_rmr_query (
 }
 
 
-DAT_RETURN dat_rmr_bind (
+DAT_RETURN DAT_API dat_rmr_bind (
 	IN      DAT_RMR_HANDLE		rmr_handle,
 	IN	DAT_LMR_HANDLE		lmr_handle,
 	IN      const DAT_LMR_TRIPLET	*lmr_triplet,
@@ -857,7 +853,7 @@ DAT_RETURN dat_rmr_bind (
 }
 
 
-DAT_RETURN dat_rmr_free (
+DAT_RETURN DAT_API dat_rmr_free (
 	IN      DAT_RMR_HANDLE		rmr_handle)
 {
     if (rmr_handle == NULL)
@@ -867,7 +863,7 @@ DAT_RETURN dat_rmr_free (
     return DAT_RMR_FREE (rmr_handle);
 }
 
-DAT_RETURN dat_lmr_sync_rdma_read(
+DAT_RETURN DAT_API dat_lmr_sync_rdma_read(
 	IN      DAT_IA_HANDLE           ia_handle,
 	IN      const DAT_LMR_TRIPLET   *local_segments,
 	IN      DAT_VLEN                num_segments)
@@ -875,8 +871,7 @@ DAT_RETURN dat_lmr_sync_rdma_read(
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_LMR_SYNC_RDMA_READ (dapl_ia_handle,
@@ -888,7 +883,7 @@ DAT_RETURN dat_lmr_sync_rdma_read(
     return dat_status;
 }
 
-DAT_RETURN dat_lmr_sync_rdma_write(
+DAT_RETURN DAT_API dat_lmr_sync_rdma_write(
 	IN      DAT_IA_HANDLE           ia_handle,
 	IN      const DAT_LMR_TRIPLET   *local_segments,
 	IN      DAT_VLEN                num_segments)
@@ -896,8 +891,7 @@ DAT_RETURN dat_lmr_sync_rdma_write(
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_LMR_SYNC_RDMA_WRITE (dapl_ia_handle,
@@ -909,7 +903,7 @@ DAT_RETURN dat_lmr_sync_rdma_write(
 }
 
 
-DAT_RETURN dat_psp_create (
+DAT_RETURN DAT_API dat_psp_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	IN      DAT_CONN_QUAL		conn_qual,
 	IN      DAT_EVD_HANDLE		evd_handle,
@@ -919,8 +913,7 @@ DAT_RETURN dat_psp_create (
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_PSP_CREATE (dapl_ia_handle,
@@ -934,7 +927,7 @@ DAT_RETURN dat_psp_create (
 }
 
 
-DAT_RETURN dat_psp_create_any (
+DAT_RETURN DAT_API dat_psp_create_any (
 	IN      DAT_IA_HANDLE		ia_handle,
 	OUT     DAT_CONN_QUAL		*conn_qual,
 	IN      DAT_EVD_HANDLE		evd_handle,
@@ -944,8 +937,7 @@ DAT_RETURN dat_psp_create_any (
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_PSP_CREATE_ANY (dapl_ia_handle,
@@ -959,7 +951,7 @@ DAT_RETURN dat_psp_create_any (
 }
 
 
-DAT_RETURN dat_psp_query (
+DAT_RETURN DAT_API dat_psp_query (
 	IN      DAT_PSP_HANDLE		psp_handle,
 	IN      DAT_PSP_PARAM_MASK	psp_param_mask,
 	OUT     DAT_PSP_PARAM 		*psp_param)
@@ -974,7 +966,7 @@ DAT_RETURN dat_psp_query (
 }
 
 
-DAT_RETURN dat_psp_free (
+DAT_RETURN DAT_API dat_psp_free (
 	IN      DAT_PSP_HANDLE	psp_handle)
 {
     if (psp_handle == NULL)
@@ -984,7 +976,7 @@ DAT_RETURN dat_psp_free (
     return DAT_PSP_FREE (psp_handle);
 }
 
-DAT_RETURN dat_csp_create (
+DAT_RETURN DAT_API dat_csp_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	IN      DAT_COMM		*comm,
 	IN	DAT_IA_ADDRESS_PTR	address,
@@ -994,8 +986,7 @@ DAT_RETURN dat_csp_create (
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_CSP_CREATE (dapl_ia_handle,
@@ -1007,7 +998,7 @@ DAT_RETURN dat_csp_create (
     return dat_status;
 }
 
-DAT_RETURN dat_csp_query (
+DAT_RETURN DAT_API dat_csp_query (
 	IN      DAT_CSP_HANDLE		csp_handle,
 	IN      DAT_CSP_PARAM_MASK	csp_param_mask,
 	OUT     DAT_CSP_PARAM 		*csp_param)
@@ -1021,7 +1012,7 @@ DAT_RETURN dat_csp_query (
 			  csp_param);
 }
 
-DAT_RETURN dat_csp_free (
+DAT_RETURN DAT_API dat_csp_free (
 	IN      DAT_CSP_HANDLE	csp_handle)
 {
     if (csp_handle == NULL)
@@ -1032,7 +1023,7 @@ DAT_RETURN dat_csp_free (
 }
 
 
-DAT_RETURN dat_rsp_create (
+DAT_RETURN DAT_API dat_rsp_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	IN      DAT_CONN_QUAL		conn_qual,
 	IN      DAT_EP_HANDLE		ep_handle,
@@ -1042,8 +1033,7 @@ DAT_RETURN dat_rsp_create (
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_RSP_CREATE (dapl_ia_handle,
@@ -1057,7 +1047,7 @@ DAT_RETURN dat_rsp_create (
 }
 
 
-DAT_RETURN dat_rsp_query (
+DAT_RETURN DAT_API dat_rsp_query (
 	IN      DAT_RSP_HANDLE		rsp_handle,
 	IN      DAT_RSP_PARAM_MASK	rsp_param_mask,
 	OUT     DAT_RSP_PARAM		*rsp_param)
@@ -1072,7 +1062,7 @@ DAT_RETURN dat_rsp_query (
 }
 
 
-DAT_RETURN dat_rsp_free (
+DAT_RETURN DAT_API dat_rsp_free (
 	IN      DAT_RSP_HANDLE		rsp_handle)
 {
     if (rsp_handle == NULL)
@@ -1083,15 +1073,14 @@ DAT_RETURN dat_rsp_free (
 }
 
 
-DAT_RETURN dat_pz_create (
+DAT_RETURN DAT_API dat_pz_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	OUT     DAT_PZ_HANDLE		*pz_handle)
 {
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_PZ_CREATE (dapl_ia_handle,
@@ -1102,7 +1091,7 @@ DAT_RETURN dat_pz_create (
 }
 
 
-DAT_RETURN dat_pz_query (
+DAT_RETURN DAT_API dat_pz_query (
 	IN      DAT_PZ_HANDLE		pz_handle,
 	IN      DAT_PZ_PARAM_MASK	pz_param_mask,
 	OUT     DAT_PZ_PARAM		*pz_param)
@@ -1117,7 +1106,7 @@ DAT_RETURN dat_pz_query (
 }
 
 
-DAT_RETURN dat_pz_free (
+DAT_RETURN DAT_API dat_pz_free (
 	IN      DAT_PZ_HANDLE		pz_handle)
 {
     if (pz_handle == NULL)
@@ -1127,7 +1116,7 @@ DAT_RETURN dat_pz_free (
     return DAT_PZ_FREE (pz_handle);
 }
 
-DAT_RETURN dat_ep_create_with_srq(
+DAT_RETURN DAT_API dat_ep_create_with_srq(
         IN      DAT_IA_HANDLE          ia_handle,
         IN      DAT_PZ_HANDLE          pz_handle,
         IN      DAT_EVD_HANDLE         recv_evd_handle,
@@ -1140,8 +1129,7 @@ DAT_RETURN dat_ep_create_with_srq(
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_EP_CREATE_WITH_SRQ (dapl_ia_handle,
@@ -1157,7 +1145,7 @@ DAT_RETURN dat_ep_create_with_srq(
     return dat_status;
 }
 
-DAT_RETURN dat_ep_recv_query(
+DAT_RETURN DAT_API dat_ep_recv_query(
         IN      DAT_EP_HANDLE         ep_handle,
         OUT     DAT_COUNT *           nbufs_allocated,
         OUT     DAT_COUNT *           bufs_alloc_span)
@@ -1171,7 +1159,7 @@ DAT_RETURN dat_ep_recv_query(
 			      bufs_alloc_span);
 }
 
-DAT_RETURN dat_ep_set_watermark(
+DAT_RETURN DAT_API dat_ep_set_watermark(
         IN      DAT_EP_HANDLE         ep_handle,
         IN      DAT_COUNT             soft_high_watermark,
         IN      DAT_COUNT             hard_high_watermark)
@@ -1187,7 +1175,7 @@ DAT_RETURN dat_ep_set_watermark(
 
 /* SRQ functions */
 
-DAT_RETURN dat_srq_create(
+DAT_RETURN DAT_API dat_srq_create(
         IN      DAT_IA_HANDLE           ia_handle,
         IN      DAT_PZ_HANDLE           pz_handle,
         IN      DAT_SRQ_ATTR            *srq_attr,
@@ -1196,8 +1184,7 @@ DAT_RETURN dat_srq_create(
     DAT_IA_HANDLE	dapl_ia_handle;
     DAT_RETURN		dat_status;
 
-    dat_status = dats_get_ia_handle((unsigned long)ia_handle,
-				    &dapl_ia_handle);
+    dat_status = dats_get_ia_handle(ia_handle, &dapl_ia_handle);
     if (dat_status == DAT_SUCCESS)
     {
 	dat_status = DAT_SRQ_CREATE(dapl_ia_handle,
@@ -1209,13 +1196,13 @@ DAT_RETURN dat_srq_create(
     return dat_status;
 }
 
-DAT_RETURN dat_srq_free(
+DAT_RETURN DAT_API dat_srq_free(
 	IN      DAT_SRQ_HANDLE        srq_handle)
 {
     return DAT_SRQ_FREE (srq_handle);
 }
 
-DAT_RETURN dat_srq_post_recv(
+DAT_RETURN DAT_API dat_srq_post_recv(
 	IN      DAT_SRQ_HANDLE         srq_handle,
 	IN      DAT_COUNT              num_segments,
 	IN      DAT_LMR_TRIPLET *      local_iov,
@@ -1231,7 +1218,7 @@ DAT_RETURN dat_srq_post_recv(
 			      user_cookie);
 }
 
-DAT_RETURN dat_srq_query(
+DAT_RETURN DAT_API dat_srq_query(
 	IN      DAT_SRQ_HANDLE         srq_handle,
 	IN      DAT_SRQ_PARAM_MASK     srq_param_mask,
 	OUT     DAT_SRQ_PARAM *        srq_param)
@@ -1245,7 +1232,7 @@ DAT_RETURN dat_srq_query(
 			  srq_param);
 }
 
-DAT_RETURN dat_srq_resize(
+DAT_RETURN DAT_API dat_srq_resize(
 	IN      DAT_SRQ_HANDLE         srq_handle,
 	IN      DAT_COUNT              srq_max_recv_dto)
 {
@@ -1257,7 +1244,7 @@ DAT_RETURN dat_srq_resize(
 			   srq_max_recv_dto);
 }
 
-DAT_RETURN dat_srq_set_lw(
+DAT_RETURN DAT_API dat_srq_set_lw(
 	IN      DAT_SRQ_HANDLE         srq_handle,
 	IN      DAT_COUNT              low_watermark)
 {
@@ -1270,8 +1257,10 @@ DAT_RETURN dat_srq_set_lw(
 }
 
 #ifdef DAT_EXTENSIONS
+
 extern int g_dat_extensions;
-DAT_RETURN dat_extension_op(
+
+DAT_RETURN DAT_API dat_extension_op(
         IN      DAT_HANDLE              handle,
         IN      DAT_EXTENDED_OP         ext_op,
         IN      ... )
@@ -1282,8 +1271,7 @@ DAT_RETURN dat_extension_op(
      va_list args;
 
      /* If not IA handle then just passthrough */
-     if (dats_get_ia_handle((unsigned long)handle,
-				&dapl_handle) != DAT_SUCCESS)
+     if (dats_get_ia_handle(handle, &dapl_handle) != DAT_SUCCESS)
      {
 	     dapl_handle = handle;
      }
diff --git a/dat/common/dat_init.h b/dat/common/dat_init.h
index 9010afd..4596b01 100644
--- a/dat/common/dat_init.h
+++ b/dat/common/dat_init.h
@@ -66,22 +66,33 @@ typedef enum
 DAT_MODULE_STATE
 dat_module_get_state ( void ) ;
 
+#if defined(_MSC_VER) || defined(_WIN64) || defined(_WIN32)
+/* NT. MSC compiler, Win32/64 platform */
+void
+dat_init ( void );
+
+void
+dat_fini ( void );
+
+#else /* GNU C */
+
 void
 dat_init ( void ) __attribute__ ((constructor));
 
 void
 dat_fini ( void ) __attribute__ ((destructor));
+#endif
 
 extern DAT_RETURN 
 dats_handle_vector_init ( void );
 
-extern unsigned long
+extern DAT_IA_HANDLE
 dats_set_ia_handle (
 	IN  DAT_IA_HANDLE		ia_handle);
 
 extern DAT_RETURN 
 dats_get_ia_handle(
-	IN	unsigned long		handle,
+	IN	DAT_IA_HANDLE		handle,
 	OUT	DAT_IA_HANDLE		*ia_handle_p);
 
 extern DAT_BOOLEAN
@@ -90,6 +101,6 @@ dats_is_ia_handle (
 
 extern DAT_RETURN 
 dats_free_ia_handle(
-	IN	unsigned long		handle);
+	IN	DAT_IA_HANDLE		handle);
 
 #endif
diff --git a/dat/common/dat_strerror.c b/dat/common/dat_strerror.c
index 5f88336..885a261 100644
--- a/dat/common/dat_strerror.c
+++ b/dat/common/dat_strerror.c
@@ -49,12 +49,12 @@
  *                                                                   *
  *********************************************************************/
 
-DAT_RETURN
+static DAT_RETURN
 dat_strerror_major (
     IN  DAT_RETURN 		value,
     OUT const char 		**message );
 
-DAT_RETURN
+static DAT_RETURN
 dat_strerror_minor (
     IN  DAT_RETURN 		value,
     OUT const char 		**message );
@@ -66,7 +66,7 @@ dat_strerror_minor (
  *                                                                   *
  *********************************************************************/
 
-DAT_RETURN
+static DAT_RETURN
 dat_strerror_major (
     IN  DAT_RETURN 		value,
     OUT const char 		**message )
@@ -187,7 +187,7 @@ dat_strerror_major (
 }
 
 
-DAT_RETURN
+static DAT_RETURN
 dat_strerror_minor (
     IN  DAT_RETURN 		value,
     OUT const char 		**message )
@@ -600,7 +600,7 @@ dat_strerror_minor (
  *                                                                   *
  *********************************************************************/
 
-DAT_RETURN
+DAT_RETURN DAT_API
 dat_strerror (
     IN  DAT_RETURN 		value,
     OUT const char 		**major_message,
diff --git a/dat/include/dat/dat.h b/dat/include/dat/dat.h
index 7fa543b..9c1632c 100755
--- a/dat/include/dat/dat.h
+++ b/dat/include/dat/dat.h
@@ -58,6 +58,11 @@
 
 #include <dat/dat_error.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 /* Generic DAT types */
 
 typedef char *  DAT_NAME_PTR;	/* Format for ia_name and attributes */
@@ -972,7 +977,7 @@ typedef struct dat_provider_info
  * unload the library after the last close.
  */
 
-extern DAT_RETURN dat_ia_openv (
+extern DAT_RETURN DAT_API dat_ia_openv (
 	IN      const DAT_NAME_PTR,	/* provider             */
 	IN      DAT_COUNT,		/* asynch_evd_min_qlen  */
 	INOUT   DAT_EVD_HANDLE *,	/* asynch_evd_handle    */
@@ -986,7 +991,7 @@ extern DAT_RETURN dat_ia_openv (
 		DAT_VERSION_MAJOR, DAT_VERSION_MINOR, \
 		DAT_THREADSAFE)
 
-extern DAT_RETURN dat_ia_query (
+extern  DAT_RETURN DAT_API dat_ia_query (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	OUT     DAT_EVD_HANDLE *,	/* async_evd_handle     */
 	IN      DAT_IA_ATTR_MASK,	/* ia_attr_mask         */
@@ -994,38 +999,38 @@ extern DAT_RETURN dat_ia_query (
 	IN      DAT_PROVIDER_ATTR_MASK,	/* provider_attr_mask   */
 	OUT     DAT_PROVIDER_ATTR * );	/* provider_attr        */
 
-extern DAT_RETURN dat_ia_close (
+extern  DAT_RETURN DAT_API dat_ia_close (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	IN      DAT_CLOSE_FLAGS );	/* close_flags          */
 
 /* helper functions */
 
-extern DAT_RETURN dat_set_consumer_context (
+extern DAT_RETURN DAT_API dat_set_consumer_context (
 	IN      DAT_HANDLE,		/* dat_handle           */
 	IN      DAT_CONTEXT);		/* context              */
 
-extern DAT_RETURN dat_get_consumer_context (
+extern DAT_RETURN DAT_API dat_get_consumer_context (
 	IN      DAT_HANDLE,		/* dat_handle           */
 	OUT     DAT_CONTEXT * );	/* context              */
 
-extern DAT_RETURN dat_get_handle_type (
+extern DAT_RETURN DAT_API dat_get_handle_type (
 	IN      DAT_HANDLE,		/* dat_handle           */
 	OUT     DAT_HANDLE_TYPE * );	/* handle_type          */
 
 /* CR functions */
 
-extern DAT_RETURN dat_cr_query (
+extern DAT_RETURN DAT_API dat_cr_query (
 	IN      DAT_CR_HANDLE,		/* cr_handle            */
 	IN      DAT_CR_PARAM_MASK,	/* cr_param_mask        */
 	OUT     DAT_CR_PARAM * );	/* cr_param             */
 
-extern DAT_RETURN dat_cr_accept (
+extern DAT_RETURN DAT_API dat_cr_accept (
 	IN      DAT_CR_HANDLE,		/* cr_handle            */
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_COUNT,		/* private_data_size    */
 	IN      const DAT_PVOID );	/* private_data         */
 
-extern DAT_RETURN dat_cr_reject (
+extern DAT_RETURN DAT_API dat_cr_reject (
 	IN      DAT_CR_HANDLE, 		/* cr_handle            */
 	IN	DAT_COUNT,		/* private_data_size	*/
 	IN const DAT_PVOID );		/* private_data		*/
@@ -1033,35 +1038,35 @@ extern DAT_RETURN dat_cr_reject (
 /* For DAT-1.1 and above, this function is defined for both uDAPL and
  * kDAPL. For DAT-1.0, it is only defined for uDAPL.
  */
-extern DAT_RETURN dat_cr_handoff (
+extern DAT_RETURN DAT_API dat_cr_handoff (
 	IN      DAT_CR_HANDLE,		/* cr_handle            */
 	IN      DAT_CONN_QUAL);		/* handoff              */
 
 /* EVD functions */
 
-extern DAT_RETURN dat_evd_resize (
+extern DAT_RETURN DAT_API dat_evd_resize (
 	IN      DAT_EVD_HANDLE,	        /* evd_handle           */
 	IN      DAT_COUNT );	        /* evd_min_qlen         */
 
-extern DAT_RETURN dat_evd_post_se (
+extern DAT_RETURN DAT_API dat_evd_post_se (
 	IN      DAT_EVD_HANDLE,	        /* evd_handle           */
 	IN      const DAT_EVENT * );    /* event                */
 
-extern DAT_RETURN dat_evd_dequeue (
+extern DAT_RETURN DAT_API dat_evd_dequeue (
 	IN      DAT_EVD_HANDLE,		/* evd_handle           */
 	OUT     DAT_EVENT * );		/* event                */
 
-extern DAT_RETURN dat_evd_query (
+extern DAT_RETURN DAT_API dat_evd_query (
 	IN      DAT_EVD_HANDLE,		/* evd_handle           */
 	IN      DAT_EVD_PARAM_MASK,	/* evd_param_mask       */
 	OUT     DAT_EVD_PARAM * );	/* evd_param            */
 
-extern DAT_RETURN dat_evd_free (
+extern DAT_RETURN DAT_API dat_evd_free (
 	IN      DAT_EVD_HANDLE );	/* evd_handle           */
 
 /* EP functions */
 
-extern DAT_RETURN dat_ep_create (
+extern DAT_RETURN DAT_API dat_ep_create (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	IN      DAT_PZ_HANDLE,		/* pz_handle            */
 	IN      DAT_EVD_HANDLE,		/* recv_completion_evd_handle */
@@ -1070,17 +1075,17 @@ extern DAT_RETURN dat_ep_create (
 	IN      const DAT_EP_ATTR *,	/* ep_attributes        */
 	OUT     DAT_EP_HANDLE * );	/* ep_handle            */
 
-extern DAT_RETURN dat_ep_query (
+extern DAT_RETURN DAT_API dat_ep_query (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_EP_PARAM_MASK,	/* ep_param_mask        */
 	OUT     DAT_EP_PARAM * );	/* ep_param             */
 
-extern DAT_RETURN dat_ep_modify (
+extern DAT_RETURN DAT_API dat_ep_modify (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_EP_PARAM_MASK,	/* ep_param_mask        */
 	IN      const DAT_EP_PARAM * ); /* ep_param             */
 
-extern DAT_RETURN dat_ep_connect (
+extern DAT_RETURN DAT_API dat_ep_connect (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_IA_ADDRESS_PTR,	/* remote_ia_address    */
 	IN      DAT_CONN_QUAL,		/* remote_conn_qual     */
@@ -1090,7 +1095,7 @@ extern DAT_RETURN dat_ep_connect (
 	IN      DAT_QOS,		/* quality_of_service   */
 	IN      DAT_CONNECT_FLAGS );	/* connect_flags        */
 
-extern DAT_RETURN dat_ep_dup_connect (
+extern DAT_RETURN DAT_API dat_ep_dup_connect (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_EP_HANDLE,		/* ep_dup_handle        */
 	IN      DAT_TIMEOUT,		/* timeout              */
@@ -1098,25 +1103,25 @@ extern DAT_RETURN dat_ep_dup_connect (
 	IN      const DAT_PVOID,	/* private_data         */
 	IN      DAT_QOS);		/* quality_of_service   */
 
-extern DAT_RETURN dat_ep_common_connect (
+extern DAT_RETURN DAT_API dat_ep_common_connect (
 	IN      DAT_EP_HANDLE,          /* ep_handle            */
 	IN      DAT_IA_ADDRESS_PTR,     /* remote_ia_address    */
 	IN      DAT_TIMEOUT,            /* timeout              */
 	IN      DAT_COUNT,              /* private_data_size    */
 	IN      const DAT_PVOID );      /* private_data         */
 
-extern DAT_RETURN dat_ep_disconnect (
+extern DAT_RETURN DAT_API dat_ep_disconnect (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_CLOSE_FLAGS );	/* close_flags          */
 
-extern DAT_RETURN dat_ep_post_send (
+extern DAT_RETURN DAT_API dat_ep_post_send (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_COUNT,		/* num_segments         */
 	IN      DAT_LMR_TRIPLET *,	/* local_iov            */
 	IN      DAT_DTO_COOKIE,		/* user_cookie          */
 	IN      DAT_COMPLETION_FLAGS ); /* completion_flags     */
 
-extern DAT_RETURN dat_ep_post_send_with_invalidate (
+extern DAT_RETURN DAT_API dat_ep_post_send_with_invalidate (
 	IN      DAT_EP_HANDLE,          /* ep_handle            */
 	IN      DAT_COUNT,              /* num_segments         */
 	IN      DAT_LMR_TRIPLET *,      /* local_iov            */
@@ -1125,14 +1130,14 @@ extern DAT_RETURN dat_ep_post_send_with_invalidate (
 	IN	DAT_BOOLEAN,		/* invalidate_flag 	*/
 	IN	DAT_RMR_CONTEXT );	/* RMR to invalidate	*/
 
-extern DAT_RETURN dat_ep_post_recv (
+extern DAT_RETURN DAT_API dat_ep_post_recv (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_COUNT,		/* num_segments         */
 	IN      DAT_LMR_TRIPLET *,	/* local_iov            */
 	IN      DAT_DTO_COOKIE,		/* user_cookie          */
 	IN      DAT_COMPLETION_FLAGS ); /* completion_flags     */
 
-extern DAT_RETURN dat_ep_post_rdma_read (
+extern DAT_RETURN DAT_API dat_ep_post_rdma_read (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_COUNT,		/* num_segments         */
 	IN      DAT_LMR_TRIPLET *,	/* local_iov            */
@@ -1140,14 +1145,14 @@ extern DAT_RETURN dat_ep_post_rdma_read (
 	IN      const DAT_RMR_TRIPLET *,/* remote_iov           */
 	IN      DAT_COMPLETION_FLAGS ); /* completion_flags     */
 
-extern DAT_RETURN dat_ep_post_rdma_read_to_rmr (
+extern DAT_RETURN DAT_API dat_ep_post_rdma_read_to_rmr (
 	IN      DAT_EP_HANDLE,          /* ep_handle            */
 	IN const DAT_RMR_TRIPLET *,      /* local_iov            */
 	IN      DAT_DTO_COOKIE,         /* user_cookie          */
 	IN      const DAT_RMR_TRIPLET *,/* remote_iov           */
 	IN      DAT_COMPLETION_FLAGS ); /* completion_flags     */
 
-extern DAT_RETURN dat_ep_post_rdma_write (
+extern DAT_RETURN DAT_API dat_ep_post_rdma_write (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_COUNT,		/* num_segments         */
 	IN      DAT_LMR_TRIPLET *,	/* local_iov            */
@@ -1155,19 +1160,19 @@ extern DAT_RETURN dat_ep_post_rdma_write (
 	IN      const DAT_RMR_TRIPLET *,/* remote_iov           */
 	IN      DAT_COMPLETION_FLAGS ); /* completion_flags     */
 
-extern DAT_RETURN dat_ep_get_status (
+extern DAT_RETURN DAT_API dat_ep_get_status (
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	OUT     DAT_EP_STATE *,		/* ep_state             */
 	OUT     DAT_BOOLEAN *,		/* recv_idle            */
 	OUT     DAT_BOOLEAN * );	/* request_idle         */
 
-extern DAT_RETURN dat_ep_free (
+extern DAT_RETURN DAT_API dat_ep_free (
 	IN      DAT_EP_HANDLE);		/* ep_handle            */
 
-extern DAT_RETURN dat_ep_reset (
+extern DAT_RETURN DAT_API dat_ep_reset (
 	IN      DAT_EP_HANDLE);		/* ep_handle            */
 
-extern DAT_RETURN dat_ep_create_with_srq (
+extern DAT_RETURN DAT_API dat_ep_create_with_srq (
         IN      DAT_IA_HANDLE,          /* ia_handle            */
         IN      DAT_PZ_HANDLE,          /* pz_handle            */
         IN      DAT_EVD_HANDLE,         /* recv_evd_handle      */
@@ -1177,49 +1182,49 @@ extern DAT_RETURN dat_ep_create_with_srq (
         IN      const DAT_EP_ATTR *,    /* ep_attributes        */
         OUT     DAT_EP_HANDLE *);       /* ep_handle            */
 
-extern DAT_RETURN dat_ep_recv_query (
+extern DAT_RETURN DAT_API dat_ep_recv_query (
         IN      DAT_EP_HANDLE,          /* ep_handle            */
         OUT     DAT_COUNT *,            /* nbufs_allocated      */
         OUT     DAT_COUNT *);           /* bufs_alloc_span      */
 
-extern DAT_RETURN dat_ep_set_watermark (
+extern DAT_RETURN DAT_API dat_ep_set_watermark (
         IN      DAT_EP_HANDLE,          /* ep_handle            */
         IN      DAT_COUNT,              /* soft_high_watermark  */
         IN      DAT_COUNT);             /* hard_high_watermark  */
 
 /* LMR functions */
 
-extern DAT_RETURN dat_lmr_free (
+extern DAT_RETURN DAT_API dat_lmr_free (
 	IN      DAT_LMR_HANDLE);	/* lmr_handle           */
 
 /* Non-coherent memory functions */
 
-extern DAT_RETURN dat_lmr_sync_rdma_read (
+extern DAT_RETURN DAT_API dat_lmr_sync_rdma_read (
 	IN      DAT_IA_HANDLE,          /* ia_handle            */
 	IN      const DAT_LMR_TRIPLET *, /* local_segments      */
 	IN      DAT_VLEN);              /* num_segments         */
 
-extern DAT_RETURN dat_lmr_sync_rdma_write (
+extern DAT_RETURN DAT_API dat_lmr_sync_rdma_write (
 	IN      DAT_IA_HANDLE,          /* ia_handle            */
 	IN      const DAT_LMR_TRIPLET *, /* local_segments      */
 	IN      DAT_VLEN);              /* num_segments         */
 
 /* RMR functions */
 
-extern DAT_RETURN dat_rmr_create (
+extern DAT_RETURN DAT_API dat_rmr_create (
 	IN      DAT_PZ_HANDLE,		/* pz_handle            */
 	OUT     DAT_RMR_HANDLE *);	/* rmr_handle           */
 
-extern DAT_RETURN dat_rmr_create_for_ep (
+extern DAT_RETURN DAT_API dat_rmr_create_for_ep (
 	IN      DAT_PZ_HANDLE,          /* pz_handle            */
 	OUT     DAT_RMR_HANDLE *);      /* rmr_handle           */
 
-extern DAT_RETURN dat_rmr_query (
+extern DAT_RETURN DAT_API dat_rmr_query (
 	IN      DAT_RMR_HANDLE,		/* rmr_handle           */
 	IN      DAT_RMR_PARAM_MASK,	/* rmr_param_mask       */
 	OUT     DAT_RMR_PARAM *);	/* rmr_param            */
 
-extern DAT_RETURN dat_rmr_bind (
+extern DAT_RETURN DAT_API dat_rmr_bind (
 	IN      DAT_RMR_HANDLE,		/* rmr_handle           */
 	IN	DAT_LMR_HANDLE,		/* lmr_handle		*/
 	IN      const DAT_LMR_TRIPLET *,/* lmr_triplet          */
@@ -1230,114 +1235,114 @@ extern DAT_RETURN dat_rmr_bind (
 	IN      DAT_COMPLETION_FLAGS,	/* completion_flags     */
 	OUT     DAT_RMR_CONTEXT * );	/* context              */
 
-extern DAT_RETURN dat_rmr_free (
+extern DAT_RETURN DAT_API dat_rmr_free (
 	IN      DAT_RMR_HANDLE);	/* rmr_handle           */
 
 /* PSP functions */
 
-extern DAT_RETURN dat_psp_create (
+extern DAT_RETURN DAT_API dat_psp_create (
 	IN      DAT_IA_HANDLE,          /* ia_handle            */
 	IN      DAT_CONN_QUAL,          /* conn_qual            */
 	IN      DAT_EVD_HANDLE,         /* evd_handle           */
 	IN      DAT_PSP_FLAGS,          /* psp_flags            */
 	OUT     DAT_PSP_HANDLE * );     /* psp_handle           */
 
-extern DAT_RETURN dat_psp_create_any (
+extern DAT_RETURN DAT_API dat_psp_create_any (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	OUT     DAT_CONN_QUAL *,	/* conn_qual            */
 	IN      DAT_EVD_HANDLE,		/* evd_handle           */
 	IN      DAT_PSP_FLAGS,		/* psp_flags            */
 	OUT     DAT_PSP_HANDLE * );	/* psp_handle           */
 
-extern DAT_RETURN dat_psp_query (
+extern DAT_RETURN DAT_API dat_psp_query (
 	IN      DAT_PSP_HANDLE,		/* psp_handle           */
 	IN      DAT_PSP_PARAM_MASK,	/* psp_param_mask       */
 	OUT     DAT_PSP_PARAM * );	/* psp_param            */
 
-extern DAT_RETURN dat_psp_free (
+extern DAT_RETURN DAT_API dat_psp_free (
 	IN      DAT_PSP_HANDLE );	/* psp_handle           */
 
 /* RSP functions */
 
-extern DAT_RETURN dat_rsp_create (
+extern DAT_RETURN DAT_API dat_rsp_create (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	IN      DAT_CONN_QUAL,		/* conn_qual            */
 	IN      DAT_EP_HANDLE,		/* ep_handle            */
 	IN      DAT_EVD_HANDLE,		/* evd_handle           */
 	OUT     DAT_RSP_HANDLE * );	/* rsp_handle           */
 
-extern DAT_RETURN dat_rsp_query (
+extern DAT_RETURN DAT_API dat_rsp_query (
 	IN      DAT_RSP_HANDLE,		/* rsp_handle           */
 	IN      DAT_RSP_PARAM_MASK,	/* rsp_param_mask       */
 	OUT     DAT_RSP_PARAM * );	/* rsp_param            */
 
-extern DAT_RETURN dat_rsp_free (
+extern DAT_RETURN DAT_API dat_rsp_free (
 	IN      DAT_RSP_HANDLE );	/* rsp_handle           */
 
 /* CSP functions */
 
-extern DAT_RETURN dat_csp_create (
+extern DAT_RETURN DAT_API dat_csp_create (
 	IN      DAT_IA_HANDLE,          /* ia_handle            */
 	IN      DAT_COMM *,          	/* communicator		*/
 	IN      DAT_IA_ADDRESS_PTR,     /* address		*/
 	IN      DAT_EVD_HANDLE,         /* evd_handle           */
 	OUT     DAT_CSP_HANDLE * );     /* csp_handle           */
 
-extern DAT_RETURN dat_csp_query (
+extern DAT_RETURN DAT_API dat_csp_query (
 	IN      DAT_CSP_HANDLE,         /* csp_handle           */
 	IN      DAT_CSP_PARAM_MASK,     /* csp_param_mask       */
 	OUT     DAT_CSP_PARAM * );      /* csp_param            */
 
-extern DAT_RETURN dat_csp_free (
+extern DAT_RETURN DAT_API dat_csp_free (
 	IN      DAT_CSP_HANDLE );       /* csp_handle           */
 
 /* PZ functions */
 
-extern DAT_RETURN dat_pz_create (
+extern DAT_RETURN DAT_API dat_pz_create (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	OUT     DAT_PZ_HANDLE * );	/* pz_handle            */
 
-extern DAT_RETURN dat_pz_query (
+extern DAT_RETURN DAT_API dat_pz_query (
 	IN      DAT_PZ_HANDLE,		/* pz_handle            */
 	IN      DAT_PZ_PARAM_MASK,	/* pz_param_mask        */
 	OUT     DAT_PZ_PARAM *);	/* pz_param             */
 
-extern DAT_RETURN dat_pz_free (
+extern DAT_RETURN DAT_API dat_pz_free (
 	IN      DAT_PZ_HANDLE );	/* pz_handle            */
 
 /* SRQ functions */
 
-extern DAT_RETURN dat_srq_create (
+extern DAT_RETURN DAT_API dat_srq_create (
         IN      DAT_IA_HANDLE,          /* ia_handle            */
         IN      DAT_PZ_HANDLE,          /* pz_handle            */
         IN      DAT_SRQ_ATTR *,         /* srq_attr             */
         OUT     DAT_SRQ_HANDLE *);      /* srq_handle           */
 
-extern DAT_RETURN dat_srq_free (
+extern DAT_RETURN DAT_API dat_srq_free (
 	IN      DAT_SRQ_HANDLE);        /* srq_handle           */
 
-extern DAT_RETURN dat_srq_post_recv (
+extern DAT_RETURN DAT_API dat_srq_post_recv (
 	IN      DAT_SRQ_HANDLE,         /* srq_handle           */
 	IN      DAT_COUNT,              /* num_segments         */
 	IN      DAT_LMR_TRIPLET *,      /* local_iov            */
 	IN      DAT_DTO_COOKIE);        /* user_cookie          */
 
-extern DAT_RETURN dat_srq_query (
+extern DAT_RETURN DAT_API dat_srq_query (
 	IN      DAT_SRQ_HANDLE,         /* srq_handle           */
 	IN      DAT_SRQ_PARAM_MASK,     /* srq_param_mask       */
 	OUT     DAT_SRQ_PARAM *);       /* srq_param            */
 
-extern DAT_RETURN dat_srq_resize (
+extern DAT_RETURN DAT_API dat_srq_resize (
 	IN      DAT_SRQ_HANDLE,         /* srq_handle           */
 	IN      DAT_COUNT);             /* srq_max_recv_dto     */
 
-extern DAT_RETURN dat_srq_set_lw (
+extern DAT_RETURN DAT_API dat_srq_set_lw (
 	IN      DAT_SRQ_HANDLE,         /* srq_handle           */
 	IN      DAT_COUNT);             /* low_watermark        */
 
 #ifdef DAT_EXTENSIONS
 typedef int	DAT_EXTENDED_OP;
-extern DAT_RETURN dat_extension_op(
+extern DAT_RETURN DAT_API dat_extension_op(
 	IN	DAT_HANDLE,		/* handle */
 	IN      DAT_EXTENDED_OP,	/* operation */
 	IN	... );			/* args */
@@ -1349,7 +1354,7 @@ extern DAT_RETURN dat_extension_op(
  * Note the dat_ia_open and dat_ia_close functions are linked to
  * registration code which "redirects" to the appropriate provider.
  */
-extern DAT_RETURN dat_registry_list_providers (
+extern DAT_RETURN DAT_API dat_registry_list_providers (
 	IN      DAT_COUNT,		/* max_to_return        */
 	OUT     DAT_COUNT *,		/* entries_returned     */
 	OUT     DAT_PROVIDER_INFO *(dat_provider_list[]) ); /* dat_provider_list */
@@ -1357,10 +1362,14 @@ extern DAT_RETURN dat_registry_list_providers (
 /*
  * DAT error functions.
  */
-extern DAT_RETURN dat_strerror (
+extern DAT_RETURN DAT_API dat_strerror (
 	IN      DAT_RETURN,		/* dat function return */
 	OUT     const char ** ,		/* major message string */
 	OUT     const char ** );	/* minor message string */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _DAT_H_ */
 
diff --git a/dat/include/dat/dat_platform_specific.h b/dat/include/dat/dat_platform_specific.h
index 0314035..b43fe2c 100644
--- a/dat/include/dat/dat_platform_specific.h
+++ b/dat/include/dat/dat_platform_specific.h
@@ -123,6 +123,9 @@ typedef unsigned long long	DAT_UVERYLONG;	/* unsigned longest native to
compiler
 typedef void *                  DAT_PVOID;
 typedef int                     DAT_COUNT;
 
+#define DAT_IA_HANDLE_TO_UL(a) (unsigned long)(a)
+#define UL_TO_DAT_IA_HANDLE(a) (DAT_IA_HANDLE)(a)
+
 #include <sys/socket.h>
 #include <netinet/in.h>
 typedef struct sockaddr        DAT_SOCK_ADDR;  /* Socket address header native to OS */
@@ -133,6 +136,9 @@ typedef struct sockaddr_in6    DAT_SOCK_ADDR6; /* Socket address header native t
 
 typedef DAT_UINT64		DAT_PADDR;
 
+#define DAT_API
+#define DAT_EXPORT		extern
+
 /* Solaris ends */
 
 
@@ -156,6 +162,9 @@ typedef DAT_UINT64		DAT_PADDR;
 #define UINT64_C(c)	c ## ULL
 #endif /* UINT64_C */
 
+#define DAT_IA_HANDLE_TO_UL(a) (unsigned long)(a)
+#define UL_TO_DAT_IA_HANDLE(a) (DAT_IA_HANDLE)(a)
+
 #if defined(__KERNEL__)
 #include <linux/socket.h>
 #include <linux/in.h>
@@ -174,37 +183,74 @@ typedef int DAT_FD;		/* DAT File Descriptor */
 
 typedef struct sockaddr         DAT_SOCK_ADDR; /* Socket address header native to OS */
 typedef struct sockaddr_in6     DAT_SOCK_ADDR6; /* Socket address header native to OS */
-#define DAT_AF_INET AF_INET
-#define DAT_AF_INET6 AF_INET6
-/* Linux ends */
+#define DAT_AF_INET		AF_INET
+#define DAT_AF_INET6		AF_INET6
 
+#define DAT_API
+#define DAT_EXPORT		extern
 
-/* Win32 begins */
-#elif defined(_MSC_VER) || defined(_WIN32) /* NT. MSC compiler, Win32 platform */
+/* Linux ends */
+
+/* Win32/64 begins */
+#elif defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64)
+/* NT. MSC compiler, Win32/64 platform */
 
 typedef unsigned __int32        DAT_UINT32;	/* Unsigned host order, 32 bits */
 typedef unsigned __int64        DAT_UINT64;	/* unsigned host order, 64 bits */
-typedef unsigned  long		DAT_UVERYLONG;	/* unsigned longest native to compiler */
+typedef unsigned  long	        DAT_UVERYLONG;	/* unsigned longest native to compiler */
+
+#if defined(_WIN64)
+#define DAT_IA_HANDLE_TO_UL(a) (unsigned long)((DAT_UINT64)(a))
+#define UL_TO_DAT_IA_HANDLE(a) (DAT_IA_HANDLE)((DAT_UINT64)(a))
+#else // _WIN32
+#define DAT_IA_HANDLE_TO_UL(a) (unsigned long)(a)
+#define UL_TO_DAT_IA_HANDLE(a) (DAT_IA_HANDLE)(a)
+#endif
 
 typedef void *                  DAT_PVOID;
-typedef long                    DAT_COUNT;
+typedef int                     DAT_COUNT;
+typedef DAT_UINT64              DAT_PADDR;
 
-typedef struct sockaddr         DAT_SOCK_ADDR;	/* Socket address header native to OS */
-typedef struct sockaddr_in6     DAT_SOCK_ADDR6; /* Socket address header native to OS */
+typedef struct dat_comm {
+	int	domain;
+	int	type;
+	int	protocol;
+} DAT_COMM;
+
+typedef int DAT_FD;		/* DAT File Descriptor */
+
+typedef struct sockaddr     DAT_SOCK_ADDR; /* Sock addr header native to OS */
+typedef struct sockaddr_in6 DAT_SOCK_ADDR6;/* Sock addr header native to OS */
 
 #ifndef UINT64_C
 #define UINT64_C(c) c ## i64
 #endif /* UINT64_C */
 
-#define DAT_AF_INET             AF_INET
-#define DAT_AF_INET6            AF_INET6
+#define DAT_AF_INET        AF_INET
+#define DAT_AF_INET6       AF_INET6
+
+#if defined(EXPORT_DAT_SYMBOLS)
+#define DAT_EXPORT	__declspec(dllexport)
+#else
+#define DAT_EXPORT	__declspec(dllimport)
+#endif
+
+#define DAT_API		__stdcall
+
+#ifndef __inline__
+#define __inline__	__inline
+#endif
+
+#ifndef INLINE
+#define INLINE		__inline
+#endif
 
 #if defined(__KDAPL__)
 /* must have the DDK for this definition */
 typedef PHYSICAL_ADDRESS	DAT_PADDR;
 #endif /* __KDAPL__ */
 
-/* Win32 ends */
+/* Windoze ends */
 
 
 #else
diff --git a/dat/include/dat/dat_registry.h b/dat/include/dat/dat_registry.h
index fe9db4b..80c3801 100644
--- a/dat/include/dat/dat_registry.h
+++ b/dat/include/dat/dat_registry.h
@@ -59,6 +59,11 @@
 #ifndef _DAT_REGISTRY_H_
 #define _DAT_REGISTRY_H_
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 #if defined(_UDAT_H_)
 #include <dat/udat_redirection.h>
 #elif defined(_KDAT_H_)
@@ -78,11 +83,11 @@
  *
  */
 
-extern DAT_RETURN dat_registry_add_provider (
+extern DAT_RETURN DAT_API dat_registry_add_provider (
 	IN  const DAT_PROVIDER *,               /* provider          */
 	IN  const DAT_PROVIDER_INFO* );         /* provider info     */
 
-extern DAT_RETURN dat_registry_remove_provider (
+extern DAT_RETURN DAT_API dat_registry_remove_provider (
 	IN  const DAT_PROVIDER *,               /* provider          */
 	IN  const DAT_PROVIDER_INFO* );         /* provider info     */
 
@@ -99,11 +104,11 @@ extern DAT_RETURN dat_registry_remove_provider (
 #define DAT_PROVIDER_INIT_FUNC_STR   "dat_provider_init"
 #define DAT_PROVIDER_FINI_FUNC_STR   "dat_provider_fini"
 
-typedef void ( *DAT_PROVIDER_INIT_FUNC) (
+typedef void ( DAT_API *DAT_PROVIDER_INIT_FUNC) (
 	IN const DAT_PROVIDER_INFO *,           /* provider info     */
 	IN const char *);                       /* instance data     */
 
-typedef void ( *DAT_PROVIDER_FINI_FUNC) (
+typedef void ( DAT_API *DAT_PROVIDER_FINI_FUNC) (
 	IN const DAT_PROVIDER_INFO *);          /* provider info     */
 
 typedef enum dat_ha_relationship
@@ -115,9 +120,13 @@ typedef enum dat_ha_relationship
 	DAT_HA_EXTENSION_BASE
 } DAT_HA_RELATIONSHIP;
 
-extern DAT_RETURN dat_registry_providers_related (
+extern DAT_RETURN DAT_API dat_registry_providers_related (
 	IN      const DAT_NAME_PTR,
 	IN      const DAT_NAME_PTR,
 	OUT     DAT_HA_RELATIONSHIP * );
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _DAT_REGISTRY_H_ */
diff --git a/dat/include/dat/udat.h b/dat/include/dat/udat.h
index 7a89241..a9bb2ac 100755
--- a/dat/include/dat/udat.h
+++ b/dat/include/dat/udat.h
@@ -60,6 +60,11 @@
 
 #include <dat/dat_platform_specific.h>
 
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
 typedef enum dat_mem_type
 {
         /* Shared between udat and kdat */
@@ -152,7 +157,7 @@ typedef char (* DAT_LMR_COOKIE)[DAT_LMR_COOKIE_SIZE];
 
 /* Format for OS wait proxy agent function */
 
-typedef void (*DAT_AGENT_FUNC)
+typedef void (DAT_API *DAT_AGENT_FUNC)
 (
     DAT_PVOID,                 /* instance data */
     DAT_EVD_HANDLE             /* Event Dispatcher*/
@@ -410,7 +415,7 @@ struct dat_provider_attr
  * User DAT function call definitions,
  */
 
-extern DAT_RETURN dat_lmr_create (
+extern DAT_RETURN DAT_API dat_lmr_create (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	IN      DAT_MEM_TYPE,		/* mem_type             */
 	IN      DAT_REGION_DESCRIPTION, /* region_description   */
@@ -424,72 +429,76 @@ extern DAT_RETURN dat_lmr_create (
 	OUT     DAT_VLEN *,		/* registered_length    */
 	OUT     DAT_VADDR * );		/* registered_address   */
 
-extern DAT_RETURN dat_lmr_query (
+extern DAT_RETURN DAT_API dat_lmr_query (
 	IN      DAT_LMR_HANDLE,		/* lmr_handle           */
 	IN      DAT_LMR_PARAM_MASK,	/* lmr_param_mask       */
 	OUT     DAT_LMR_PARAM * );	/* lmr_param            */
 
 /* Event Functions */
 
-extern DAT_RETURN dat_evd_create (
+extern DAT_RETURN DAT_API dat_evd_create (
 	IN      DAT_IA_HANDLE,		/* ia_handle            */
 	IN      DAT_COUNT,		/* evd_min_qlen         */
 	IN      DAT_CNO_HANDLE,		/* cno_handle           */
 	IN      DAT_EVD_FLAGS,		/* evd_flags            */
 	OUT     DAT_EVD_HANDLE * );	/* evd_handle           */
 
-extern DAT_RETURN dat_evd_modify_cno (
+extern DAT_RETURN DAT_API dat_evd_modify_cno (
 	IN      DAT_EVD_HANDLE,		/* evd_handle           */
 	IN      DAT_CNO_HANDLE);	/* cno_handle           */
 
-extern DAT_RETURN dat_cno_create (
+extern DAT_RETURN DAT_API dat_cno_create (
 	IN 	DAT_IA_HANDLE,		/* ia_handle            */
 	IN 	DAT_OS_WAIT_PROXY_AGENT,/* agent                */
 	OUT 	DAT_CNO_HANDLE *);	/* cno_handle           */
 
-extern DAT_RETURN dat_cno_modify_agent (
+extern DAT_RETURN DAT_API dat_cno_modify_agent (
 	IN 	DAT_CNO_HANDLE,		 /* cno_handle           */
 	IN 	DAT_OS_WAIT_PROXY_AGENT);/* agent                */
 
-extern DAT_RETURN dat_cno_query (
+extern DAT_RETURN DAT_API dat_cno_query (
 	IN      DAT_CNO_HANDLE,		/* cno_handle            */
 	IN      DAT_CNO_PARAM_MASK,	/* cno_param_mask        */
 	OUT     DAT_CNO_PARAM * );	/* cno_param             */
 
-extern DAT_RETURN dat_cno_free (
+extern DAT_RETURN DAT_API dat_cno_free (
 	IN DAT_CNO_HANDLE);		/* cno_handle            */
 
-extern DAT_RETURN dat_cno_wait (
+extern DAT_RETURN DAT_API dat_cno_wait (
 	IN  	DAT_CNO_HANDLE,		/* cno_handle            */
 	IN  	DAT_TIMEOUT,		/* timeout               */
 	OUT 	DAT_EVD_HANDLE *);	/* evd_handle            */
 
-extern DAT_RETURN dat_evd_enable (
+extern DAT_RETURN DAT_API dat_evd_enable (
 	IN      DAT_EVD_HANDLE);	/* evd_handle            */
 
-extern DAT_RETURN dat_evd_wait (
+extern DAT_RETURN DAT_API dat_evd_wait (
 	IN  	DAT_EVD_HANDLE,		/* evd_handle            */
 	IN  	DAT_TIMEOUT,		/* timeout               */
 	IN  	DAT_COUNT,		/* threshold             */
 	OUT 	DAT_EVENT *,		/* event                 */
 	OUT 	DAT_COUNT * );		/* n_more_events         */
 
-extern DAT_RETURN dat_evd_disable (
+extern DAT_RETURN DAT_API dat_evd_disable (
 	IN      DAT_EVD_HANDLE);	/* evd_handle            */
 
-extern DAT_RETURN dat_evd_set_unwaitable (
+extern DAT_RETURN DAT_API dat_evd_set_unwaitable (
 	IN DAT_EVD_HANDLE);		/* evd_handle            */
 
-extern DAT_RETURN dat_evd_clear_unwaitable (
+extern DAT_RETURN DAT_API dat_evd_clear_unwaitable (
 	IN DAT_EVD_HANDLE);		/* evd_handle            */
 
-extern DAT_RETURN dat_cno_fd_create (
+extern DAT_RETURN DAT_API dat_cno_fd_create (
 	IN	DAT_IA_HANDLE,		/* ia_handle		*/
 	OUT	DAT_FD *,		/* file descriptor	*/
 	OUT	DAT_CNO_HANDLE * );	/* cno_handle		*/
 
-extern DAT_RETURN dat_cno_trigger (
+extern DAT_RETURN DAT_API dat_cno_trigger (
 	IN	DAT_CNO_HANDLE,		/* cno_handle		*/
 	OUT	DAT_EVD_HANDLE * );	/* evd_handle		*/
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _UDAT_H_ */
diff --git a/dat/udat/udat.c b/dat/udat/udat.c
index 8356482..9137e65 100755
--- a/dat/udat/udat.c
+++ b/dat/udat/udat.c
@@ -82,15 +82,15 @@ int g_dat_extensions = 0;
  * Function: dat_registry_add_provider
  ***********************************************************************/
 
-DAT_RETURN
+DAT_RETURN DAT_API
 dat_registry_add_provider (
 	IN  const DAT_PROVIDER	 	*provider,
 	IN  const DAT_PROVIDER_INFO	*provider_info )
 {
-    DAT_DR_ENTRY 		entry;
+    DAT_DR_ENTRY 	entry;
 
     dat_os_dbg_print (DAT_OS_DBG_TYPE_PROVIDER_API,
-		      "DAT Registry: dat_registry_add_provider (%s,%x:%x,%x)\n",
+	      "DAT Registry: %s (%s,%x:%x,%x)\n", __FUNCTION__,
 		      provider_info->ia_name,
 		      provider_info->dapl_version_major,
 		      provider_info->dapl_version_minor,
@@ -123,7 +123,7 @@ dat_registry_add_provider (
 // Function: dat_registry_remove_provider
 //***********************************************************************
 
-DAT_RETURN
+DAT_RETURN DAT_API
 dat_registry_remove_provider (
 	IN  const DAT_PROVIDER 		*provider,
 	IN  const DAT_PROVIDER_INFO	*provider_info )
@@ -155,7 +155,7 @@ dat_registry_remove_provider (
  * Function: dat_ia_open
  ***********************************************************************/
 
-DAT_RETURN
+DAT_RETURN DAT_API
 dat_ia_openv (
     IN	   const DAT_NAME_PTR	name,
     IN	   DAT_COUNT		async_event_qlen,
@@ -271,7 +271,7 @@ dat_ia_openv (
  * Function: dat_ia_close
  ***********************************************************************/
 
-DAT_RETURN
+DAT_RETURN DAT_API
 dat_ia_close (
     IN DAT_IA_HANDLE	ia_handle,
     IN DAT_CLOSE_FLAGS	ia_flags)
@@ -366,7 +366,7 @@ dat_ia_close (
 // Function: dat_registry_list_providers
 //***********************************************************************
 
-DAT_RETURN
+DAT_RETURN DAT_API
 dat_registry_list_providers (
     IN  DAT_COUNT   		max_to_return,
     OUT DAT_COUNT   		*entries_returned,
diff --git a/dat/udat/udat_api.c b/dat/udat/udat_api.c
index 58813fe..8dea05c 100644
--- a/dat/udat/udat_api.c
+++ b/dat/udat/udat_api.c
@@ -52,7 +52,7 @@
 
 #define UDAT_IS_BAD_HANDLE(h) ( NULL == (p) )
 
-DAT_RETURN dat_lmr_create (
+DAT_RETURN DAT_API dat_lmr_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	IN      DAT_MEM_TYPE		mem_type,
 	IN      DAT_REGION_DESCRIPTION	region_description,
@@ -91,7 +91,7 @@ DAT_RETURN dat_lmr_create (
 }
 
 
-DAT_RETURN dat_evd_create (
+DAT_RETURN DAT_API dat_evd_create (
 	IN      DAT_IA_HANDLE		ia_handle,
 	IN      DAT_COUNT		evd_min_qlen,
 	IN      DAT_CNO_HANDLE		cno_handle,
@@ -116,7 +116,7 @@ DAT_RETURN dat_evd_create (
 }
 
 
-DAT_RETURN dat_evd_modify_cno (
+DAT_RETURN DAT_API dat_evd_modify_cno (
 	IN      DAT_EVD_HANDLE		evd_handle,
 	IN      DAT_CNO_HANDLE		cno_handle)
 {
@@ -129,7 +129,7 @@ DAT_RETURN dat_evd_modify_cno (
 }
 
 
-DAT_RETURN dat_cno_create (
+DAT_RETURN DAT_API dat_cno_create (
 	IN 	DAT_IA_HANDLE		ia_handle,
 	IN 	DAT_OS_WAIT_PROXY_AGENT agent,
 	OUT 	DAT_CNO_HANDLE		*cno_handle)
@@ -149,7 +149,7 @@ DAT_RETURN dat_cno_create (
     return dat_status;
 }
 
-DAT_RETURN dat_cno_fd_create (
+DAT_RETURN DAT_API dat_cno_fd_create (
 	IN 	DAT_IA_HANDLE		ia_handle,
 	OUT	DAT_FD			*fd,
 	OUT 	DAT_CNO_HANDLE		*cno_handle)
@@ -169,7 +169,7 @@ DAT_RETURN dat_cno_fd_create (
     return dat_status;
 }
 
-DAT_RETURN dat_cno_modify_agent (
+DAT_RETURN DAT_API dat_cno_modify_agent (
 	IN 	DAT_CNO_HANDLE		 cno_handle,
 	IN 	DAT_OS_WAIT_PROXY_AGENT	 agent)
 {
@@ -182,7 +182,7 @@ DAT_RETURN dat_cno_modify_agent (
 }
 
 
-DAT_RETURN dat_cno_query (
+DAT_RETURN DAT_API dat_cno_query (
 	IN      DAT_CNO_HANDLE		cno_handle,
 	IN      DAT_CNO_PARAM_MASK	cno_param_mask,
 	OUT     DAT_CNO_PARAM		*cno_param)
@@ -193,7 +193,7 @@ DAT_RETURN dat_cno_query (
 }
 
 
-DAT_RETURN dat_cno_free (
+DAT_RETURN DAT_API dat_cno_free (
 	IN DAT_CNO_HANDLE		cno_handle)
 {
     if (cno_handle == NULL)
@@ -204,7 +204,7 @@ DAT_RETURN dat_cno_free (
 }
 
 
-DAT_RETURN dat_cno_wait (
+DAT_RETURN DAT_API dat_cno_wait (
 	IN  	DAT_CNO_HANDLE		cno_handle,
 	IN  	DAT_TIMEOUT		timeout,
 	OUT 	DAT_EVD_HANDLE		*evd_handle)
@@ -219,7 +219,7 @@ DAT_RETURN dat_cno_wait (
 }
 
 
-DAT_RETURN dat_evd_enable (
+DAT_RETURN DAT_API dat_evd_enable (
 	IN      DAT_EVD_HANDLE		evd_handle)
 {
     if (evd_handle == NULL)
@@ -230,7 +230,7 @@ DAT_RETURN dat_evd_enable (
 }
 
 
-DAT_RETURN dat_evd_wait (
+DAT_RETURN DAT_API dat_evd_wait (
 	IN  	DAT_EVD_HANDLE		evd_handle,
 	IN  	DAT_TIMEOUT		Timeout,
 	IN  	DAT_COUNT		Threshold,
@@ -249,7 +249,7 @@ DAT_RETURN dat_evd_wait (
 }
 
 
-DAT_RETURN dat_evd_disable (
+DAT_RETURN DAT_API dat_evd_disable (
 	IN      DAT_EVD_HANDLE		evd_handle)
 {
     if (evd_handle == NULL)
@@ -260,7 +260,7 @@ DAT_RETURN dat_evd_disable (
 }
 
 
-DAT_RETURN dat_evd_set_unwaitable (
+DAT_RETURN DAT_API dat_evd_set_unwaitable (
 	IN 	DAT_EVD_HANDLE		 evd_handle)
 {
     if (evd_handle == NULL)
@@ -271,7 +271,7 @@ DAT_RETURN dat_evd_set_unwaitable (
 }
 
 
-DAT_RETURN dat_evd_clear_unwaitable (
+DAT_RETURN DAT_API dat_evd_clear_unwaitable (
 	IN 	DAT_EVD_HANDLE		 evd_handle)
 {
     if (evd_handle == NULL)
@@ -283,7 +283,7 @@ DAT_RETURN dat_evd_clear_unwaitable (
 
 
 
-DAT_RETURN dat_cr_handoff (
+DAT_RETURN DAT_API dat_cr_handoff (
     IN          DAT_CR_HANDLE		cr_handle,
     IN          DAT_CONN_QUAL		handoff)
 {
@@ -296,7 +296,7 @@ DAT_RETURN dat_cr_handoff (
 }
 
 
-DAT_RETURN dat_lmr_query (
+DAT_RETURN DAT_API dat_lmr_query (
 	IN      DAT_LMR_HANDLE		lmr_handle,
 	IN      DAT_LMR_PARAM_MASK	lmr_param_mask,
 	OUT     DAT_LMR_PARAM		*lmr_param)





More information about the general mailing list