Brice,

Ah, okay. That’s pretty slick. I have some renaming to do :-).

Thank you,

Sam

On Oct 10, 2019, at 11:14 AM, Brice Goglin 
<brice.gog...@inria.fr<mailto:brice.gog...@inria.fr>> wrote:


Yes.

Once you call HWLOC_SET_SYMBOL_PREFIX(), hwloc takes care of automatically 
renaming your external callers and our internal hwloc code. The idea is that 
none of us has to change your code when enabling renaming. That's how OMPI 
manages to support both renamed embedded hwloc and non-renamed external hwloc 
with the same OMPI code.

Brice


Le 10/10/2019 à 18:38, Gutierrez, Samuel K. via hwloc-users a écrit :
Sorry, I sent the previous email too quickly.

Is the recommended usage of embedded hwloc when using HWLOC_SET_SYMBOL_PREFIX 
to use the non-renamed symbols and avoid altogether the prefixed ones?

Thank you,

Sam

On Oct 10, 2019, at 10:30 AM, Brice Goglin 
<brice.gog...@inria.fr<mailto:brice.gog...@inria.fr>> wrote:

Le 10/10/2019 à 17:38, Gutierrez, Samuel K. via hwloc-users a écrit :
Good morning,

I have a question about expected name mangling behavior when using 
HWLOC_SET_SYMBOL_PREFIX in hwloc v2.1.0 (and perhaps other versions).

Say, for example, I do the following in a project embedding hwloc:

HWLOC_SET_SYMBOL_PREFIX(foo_internal_)
HWLOC_SETUP_CORE(…)
...

Now, entry points into hwloc are prefixed with foo_internal_ (e.g., 
foo_internal_hwloc_topology_init()). This all works great.

Next, let’s consider what happens to hwloc-exported constants such as 
HWLOC_OBJ_MACHINE when using the same setup above. I would expect something 
like this:
HWLOC_OBJ_MACHINE now becomes FOO_INTERNAL_HWLOC_OBJ_MACHINE. Instead, I notice 
the following curious mangling convention: FOO_INTERNAL_hwloc_OBJ_MACHINE. Is 
this intentional? If so, that’s fine—functionally, it works as expected. 
However, this seems like a bug.


Hello

#define HWLOC_NAME(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX, hwloc_ ## name)
#define HWLOC_NAME_CAPS(name) HWLOC_MUNGE_NAME(HWLOC_SYM_PREFIX_CAPS,
hwloc_ ## name)

Indeed I don't see any reason not to use HWLOC_ on the second line. It
looks like we've been doing this forever.

Even if users are supposed to only use official (non-renamed) names, I
guess there might exist a ugly hack that explicitly depends on renamed
names somewhere in hwloc users' code. So I'd rather not touch this as
long as it doesn't break anything.

Brice


_______________________________________________
hwloc-users mailing list
hwloc-users@lists.open-mpi.org<mailto:hwloc-users@lists.open-mpi.org>
https://lists.open-mpi.org/mailman/listinfo/hwloc-users




_______________________________________________
hwloc-users mailing list
hwloc-users@lists.open-mpi.org<mailto:hwloc-users@lists.open-mpi.org>
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

_______________________________________________
hwloc-users mailing list
hwloc-users@lists.open-mpi.org<mailto:hwloc-users@lists.open-mpi.org>
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

_______________________________________________
hwloc-users mailing list
hwloc-users@lists.open-mpi.org
https://lists.open-mpi.org/mailman/listinfo/hwloc-users

Reply via email to