Thread: Using DllImport with C# and C

  1. #1
    Registered User CompiledMonkey's Avatar
    Join Date
    Feb 2002
    Location
    Richmond, VA
    Posts
    438

    Using DllImport with C# and C

    I知 trying to call functions from a C dll in my C# application. I can get it to work using DllImport but I知 having an issue when a struct is a parameter in the C function call. How can I represent this in C#? Would anyone have any links or other helpful items?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    You can build a struct in C# that matches your C struct by using the StructLayout Attribute.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed