Using DllImport with C# and C

This is a discussion on Using DllImport with C# and C within the C# Programming forums, part of the General Programming Boards category; I知 trying to call functions from a C dll in my C# application. I can get it to work using ...

  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,139
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21