Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support statically linking multiple clients with application #2099

Open
zhaoqin opened this issue Dec 8, 2016 · 3 comments
Open

Support statically linking multiple clients with application #2099

zhaoqin opened this issue Dec 8, 2016 · 3 comments

Comments

@zhaoqin
Copy link
Contributor

zhaoqin commented Dec 8, 2016

DR's application API (dr_app_*) allows an app to start and stop running under DR. We may want to statically link multiple clients with the application, and control which client to use at starting.

On Linux, we could use the weak symbol trick.
Each client has two symbols:

  • a global symbol dr****_client_main is the actual initialization function.
  • a weak symbol dr_client_main either be alias to the dr****_client_main or a function simply calls dr****_client_main.
    By doing that, each client can run separately.
    When linking with an application, we can implement a global symbol dr_client_main in the app to override all the other dr_client_main in the clients, and pick which client initialization function to run by calling the corresponding dr****_client_main.
    We may be able to use command line linker option to add dr****_client_main as the alias of dr_client_main in the client to minimal the change (need more investigation).

On Windows, there is no weak symbol. We may need use __declspec(selectany) to achieve similar goal.

@zhaoqin
Copy link
Contributor Author

zhaoqin commented Dec 9, 2016

split from #2006.

@zhaoqin
Copy link
Contributor Author

zhaoqin commented Dec 9, 2016

also xref #975

@derekbruening
Copy link
Contributor

#975 is the master issue here and it has discussion about this very issue, linking multiple static clients.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants