Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Trace implementation for static methods.

Trace implementation for static methods.

Scheduled Pinned Locked Moved C#
csharpdesigndebuggingtutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Ilia Blank
    wrote on last edited by
    #1

    Hi, My C# code calls to bunch of external methods exported from gdi32.dll That’s example of the code we use to export the methods from the dll: [DllImport("gdi32.dll")] internal static extern int ExtEscape(HDC hDC, int nEscape, int inputSize, ref CWDDECMD InputData, int outputSize, ref CIWSINFO OutputData); … [DllImport("gdi32.dll")] internal static extern int ExtEscape(HDC hDC, int nEscape, int inputSize, ref CWDDECMD InputData, int outputSize, ref CIOVLTHEATERMODE OutputData); There are over two hundred of method declarations and they are different only by type of parameters (ie CIWSINFO versus CIOVLTHEATERMODE in this examle). The methods are called from all around the code. Now I have to come with design that allows tracing calls to the methods While printing the name of the method and type and values of passed parameters (this part is simple as each passed type implements ToString method). I just hate idea of duplicating each declaration with the method that performs tracing before calling to real method: [DllImport("gdi32.dll")] internal static extern int ExtEscape(…); static int ExtEscapeTrace (…) { DoTrace (); ExtEscape (…) ; //Perform real call } To bad the methods are static; otherwise I would be able to use proxies. Any ideas?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups