Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6045685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:09:09+00:00 2026-05-23T07:09:09+00:00

Especially getting the function return type(and if possible whether its a pointer type). (I’m

  • 0

Especially getting the function return type(and if possible whether its a pointer type).

(I’m trying to write auto generation of ioctl/dlsym wrapper libs(to be LD_PRELOAD ed)). A python or ruby library would be preferred but any workable solution is welcome.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T07:09:09+00:00Added an answer on May 23, 2026 at 7:09 am

    I have successfully used Haskells Language.C package from hackage (Haskells answer to CPAN) to do something similar. It will provide you with a complete parse tree of the C (or header) file which can then be traversed to extract the needed information. It should AFAIK also work with #includes #defines and so on.

    I’m afraid I don’t have the relevant software installed to test it, but it would go something like this:

    handler (DeclEvent (Declaration d)) =
    do
    let (VarDecl varName declAttr t) = getVarDecl d
    case t of 
         (FunctionType (FunType returnType params isVaradic attrs)) -> 
            do {- varName RETURNS returnType .... -}
             _ -> do return ()
        return ()
    handler _ = 
        do return ()
    
    main = do    
        let compiler = newGCC "gcc"
        ast <- parseCFile compiler Nothing opts cFileName
        case (runTrav newState (withExtDeclHandler (analyseAST ast) handler)) of
            ...
    

    The above might look scary, but you probably won’t be needing that many more lines of Haskell to do what you want! I’ll gladly share the complete source code I used (~200 lines) if it can be of any help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to return rows in Open XML form from a table value function
I need some help with getting deeper into MacRuby and XCode, especially the part
I am new bee in ANDROID so am getting problem in retrieving data especially
I'm trying to write a fairly simple threaded application, but am new to boost's
I'm getting an NPE while trying to read in an image file, and I
Especially when considering a fresh Rails project, what does your version control and deployment
Especially for the iPhone
I love grids - especially the cool third party ones like Devex, C1 etc..
I'm especially interested in memory profiling, reducing the size of a compiled .swf, measuring
I'm especially interested in solutions with source code available (Django independency is a plus,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.