How can I tell the linker which one of multiple implementations of a method to use?

zneak

I use a tool to generate a 111k-lines long C++ class implementation. The methods it generates work as they should, but they tend to trigger a slow path in the APIs that they use.

Is there any way, with Clang on Mac OS X, that I can manually implement some of the most-used methods in a different source file and tell the linker (or any other relevant program) to ignore the tool-generated method if another implementation for that method exists?

I am in complete control of the tool's output, though it would be pretty hard to automatically generate better code.

mksteve

If the code is delivered in a library, then the linker searches through the .o files in successive libraries until all unresolved symbols have been satisfied. So if your code generation can ensure the weak code is separated into different .cpp files, then you can deliver the custom written versions in an earlier .a on the link path, which will be used before the .a supplied by the code generation.

Alternatively, if you could add a false template into your code, then you could specify an explicit specialization for the code. This would be used by the compiler/linker as it is a specific specialization.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

If I use ControllerAs to use a controller twice on a page, how can the controller code tell WHICH one it's dealing with?

From Dev

How can I tell which constructor to use on an inner (member) class?

From Dev

How can i tell PyCUDA which GPU to use?

From Dev

How can I tell which one is the name if the object has more than one CN attribute?

From Dev

How can I tell which HubSection is selected

From Dev

How can I tell which commands are deprecated?

From Dev

If I've installed an application both as a snap and via APT, how can I tell which one is currently running?

From Dev

Braintree API: How can I tell which payment_method is associated with my nonce?

From Dev

How can I tell which "explorer.exe" process is the main one?

From Dev

Internet vs. telephone cable. How can I tell them apart? Which of them is this one?

From Dev

How can I tell composer which key to use for a given composer repository?

From Dev

How can I refer to implementations of a method in annotation processing?

From Dev

How can I refer to implementations of a method in annotation processing?

From Dev

How can I tell Swift to use "no" NSStringDrawingOptions

From Dev

How can I tell which user limit I am running into?

From Dev

How can I tell which version of Varnish I'm running?

From Dev

How can I tell which VNC package I'm using?

From Dev

In Unity, how to tell which window is the one I want when switching?

From Dev

How can I avoid multiple function implementations with GADTs?

From Dev

TBB Linker error How can I tell if I am missing an include or if the code is outdated

From Dev

How do I tell which is the visible window if there are multiple similar windows

From Dev

How can I tell GCC to use custom library for -l instead of the system one?

From Dev

How can I use a string from an array in one method in another?

From Dev

How can I tell which DNS servers DNSMasq is using?

From Dev

How can I tell which reference is adding a permission in Xamarin Android?

From Dev

How can I tell which button in a repeater got pressed?

From Dev

How can I tell which IDE an Android project was made with?

From Dev

How can I tell which network interface my computer is using?

From Dev

How can I tell which DNS servers DNSMasq is using?

Related Related

  1. 1

    If I use ControllerAs to use a controller twice on a page, how can the controller code tell WHICH one it's dealing with?

  2. 2

    How can I tell which constructor to use on an inner (member) class?

  3. 3

    How can i tell PyCUDA which GPU to use?

  4. 4

    How can I tell which one is the name if the object has more than one CN attribute?

  5. 5

    How can I tell which HubSection is selected

  6. 6

    How can I tell which commands are deprecated?

  7. 7

    If I've installed an application both as a snap and via APT, how can I tell which one is currently running?

  8. 8

    Braintree API: How can I tell which payment_method is associated with my nonce?

  9. 9

    How can I tell which "explorer.exe" process is the main one?

  10. 10

    Internet vs. telephone cable. How can I tell them apart? Which of them is this one?

  11. 11

    How can I tell composer which key to use for a given composer repository?

  12. 12

    How can I refer to implementations of a method in annotation processing?

  13. 13

    How can I refer to implementations of a method in annotation processing?

  14. 14

    How can I tell Swift to use "no" NSStringDrawingOptions

  15. 15

    How can I tell which user limit I am running into?

  16. 16

    How can I tell which version of Varnish I'm running?

  17. 17

    How can I tell which VNC package I'm using?

  18. 18

    In Unity, how to tell which window is the one I want when switching?

  19. 19

    How can I avoid multiple function implementations with GADTs?

  20. 20

    TBB Linker error How can I tell if I am missing an include or if the code is outdated

  21. 21

    How do I tell which is the visible window if there are multiple similar windows

  22. 22

    How can I tell GCC to use custom library for -l instead of the system one?

  23. 23

    How can I use a string from an array in one method in another?

  24. 24

    How can I tell which DNS servers DNSMasq is using?

  25. 25

    How can I tell which reference is adding a permission in Xamarin Android?

  26. 26

    How can I tell which button in a repeater got pressed?

  27. 27

    How can I tell which IDE an Android project was made with?

  28. 28

    How can I tell which network interface my computer is using?

  29. 29

    How can I tell which DNS servers DNSMasq is using?

HotTag

Archive