Results 1 to 40 of 73

Thread: how to Fast Call cdecl api like sqlite3.dll?

Threaded View

  1. #11
    PowerPoster wqweto's Avatar
    Join Date
    May 2011
    Location
    Sofia, Bulgaria
    Posts
    6,202

    Re: hao to call Sqlite3.dll with cdecl?

    Quote Originally Posted by xiaoyao View Post
    dose it support cdecl dll api?
    In the snippet above Pfn is a cdecl function pointer to _ultow function in msvcrt DLL

    Code:
        hLib = LoadLibrary("msvcrt")
        Pfn = GetProcAddress(hLib, "_ultow")
    Implementing your CallCdecl, CallCdecl2, CallCdecl3 and CallCdecl4 is trivial using the Call_ultow function as a model but you cannot get rid of its Spacer parameter easy.

    The extra paramter is needed to simplify the thunk to 21 bytes only but feel free to enhance it with rep movsb and all the other necessary instructions to shuffle the parameters on the stack as discussed above. This would allow indeed not having an extra optional Spacer parameter on your CallCdeclXxx functions.

    cheers,
    </wqw>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width