TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Call a function named in a string variable in C

4 pointsby sea6earover 8 years ago

1 comment

Gibbon1over 8 years ago
&quot;While this isn&#x27;t exactly a practical solution, I bet you could certainly call a function by a string by having a program read in it&#x27;s own executable and parse the symbols table. The symbol table should contain the name of the function as well as it&#x27;s first instruction address. You could then place this address in a function pointer variable and call it.&quot;<p>This is disgusting, but I like it.<p>Now I&#x27;m wondering if you could do something similarly gross with GDP.