@@ -24,6 +24,14 @@ static char OIF_DISPATCH_JULIA_SO[] = "liboif_dispatch_julia.so";
24
24
25
25
static const char * OIF_IMPL_ROOT_DIR ;
26
26
27
+ static char * OIF_LANG_FROM_LANG_ID [] = {
28
+ [OIF_LANG_C ] = "C" ,
29
+ [OIF_LANG_CXX ] = "C++" ,
30
+ [OIF_LANG_PYTHON ] = "Python" ,
31
+ [OIF_LANG_JULIA ] = "Julia" ,
32
+ [OIF_LANG_R ] = "R" ,
33
+ };
34
+
27
35
/**
28
36
* Array of handles to the dynamically loaded libraries
29
37
* for the language-specific dispatches.
@@ -225,9 +233,9 @@ unload_interface_impl(ImplHandle implh)
225
233
DispatchHandle dh = impl_info -> dh ;
226
234
if (OIF_DISPATCH_HANDLES [dh ] == NULL ) {
227
235
fprintf (stderr ,
228
- "[dispatch] Cannot unload interface implementation for language "
229
- "id: '%u '\n" ,
230
- dh );
236
+ "[dispatch] Cannot unload interface implementation "
237
+ "for language '%s '\n" ,
238
+ OIF_LANG_FROM_LANG_ID [ dh ] );
231
239
exit (EXIT_FAILURE );
232
240
}
233
241
void * lib_handle = OIF_DISPATCH_HANDLES [dh ];
@@ -236,9 +244,9 @@ unload_interface_impl(ImplHandle implh)
236
244
unload_impl_fn = dlsym (lib_handle , "unload_impl" );
237
245
if (unload_impl_fn == NULL ) {
238
246
fprintf (stderr ,
239
- "[dispatch] Cannot find function 'unload_impl' for lang "
240
- "id: '%u '\n" ,
241
- dh );
247
+ "[dispatch] Cannot find function 'unload_impl' "
248
+ "for language '%s '\n" ,
249
+ OIF_LANG_FROM_LANG_ID [ dh ] );
242
250
return -1 ;
243
251
}
244
252
unload_impl_fn (impl_info );
@@ -256,9 +264,9 @@ call_interface_impl(ImplHandle implh, const char *method, OIFArgs *in_args, OIFA
256
264
DispatchHandle dh = impl_info -> dh ;
257
265
if (OIF_DISPATCH_HANDLES [dh ] == NULL ) {
258
266
fprintf (stderr ,
259
- "[dispatch] Cannot call interface implementation for language "
260
- "id: '%u' " ,
261
- dh );
267
+ "[dispatch] Cannot call interface implementation "
268
+ "for language '%s'\n " ,
269
+ OIF_LANG_FROM_LANG_ID [ dh ] );
262
270
exit (EXIT_FAILURE );
263
271
}
264
272
void * lib_handle = OIF_DISPATCH_HANDLES [dh ];
@@ -268,8 +276,8 @@ call_interface_impl(ImplHandle implh, const char *method, OIFArgs *in_args, OIFA
268
276
if (call_impl_fn == NULL ) {
269
277
fprintf (stderr ,
270
278
"[dispatch] Could not load function 'call_impl' "
271
- "for language id '%u '\n" ,
272
- dh );
279
+ "for language '%s '\n" ,
280
+ OIF_LANG_FROM_LANG_ID [ dh ] );
273
281
return -1 ;
274
282
}
275
283
status = call_impl_fn (impl_info , method , in_args , out_args );
0 commit comments