C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 08-17-2005, 04:41 PM   #1
Registered User
 
CompiledMonkey's Avatar
 
Join Date: Feb 2002
Location: Richmond, VA
Posts: 438
Using DllImport with C# and C

I’m trying to call functions from a C dll in my C# application. I can get it to work using DllImport but I’m 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?
CompiledMonkey is offline   Reply With Quote
Old 08-18-2005, 05:12 AM   #2
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,769
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.
nvoigt is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump


All times are GMT -6. The time now is 07:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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