Click here to Skip to main content
15,908,909 members
Home / Discussions / C#
   

C#

 
GeneralDLL wrapper and structs Pin
pithhelmet12-Sep-03 14:10
pithhelmet12-Sep-03 14:10 
Hi Everyone -

I am trying to create a C# wrapper around a legacy C .DLL

I am stuck on one implementation area...

There is a DLL function called GetDateTime

extern "C" bool GetDateTime( DateTimeStruct &dateTime )

is how the SDK says it is to be implementated.

I have created a wrapper shell for this function below...

[DllImport("CarChipSDK", EntryPoint="GetDateTime")]
public static extern bool GetDateTime
(
//// what goes here???
);



I have create the struc in BOTH the main program,
and the shell

[StructLayout(LayoutKind.Sequential)]
public struct DateTimeStruct
{
public int year;
public int month;
public int day;
public int hour;
public int minute;
public int second;
}



Here are the questions...

1) Do I need to create a struct in both the caller and callee classes?
2) How do i setup the caller class to send the struct to the callee class?

thanks
tony

GeneralRe: DLL wrapper and structs Pin
Tym!15-Sep-03 6:48
Tym!15-Sep-03 6:48 
GeneralException from HRESULT: 0x800A01C9 Pin
ajkumar12-Sep-03 14:09
ajkumar12-Sep-03 14:09 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
leppie12-Sep-03 14:44
leppie12-Sep-03 14:44 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
ajkumar12-Sep-03 15:52
ajkumar12-Sep-03 15:52 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
leppie12-Sep-03 16:10
leppie12-Sep-03 16:10 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
J. Dunlap12-Sep-03 15:05
J. Dunlap12-Sep-03 15:05 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
ajkumar14-Sep-03 6:17
ajkumar14-Sep-03 6:17 
General#dev 0.97 released Pin
leppie12-Sep-03 10:59
leppie12-Sep-03 10:59 
GeneralRe: #dev 0.97 released Pin
J. Dunlap12-Sep-03 13:55
J. Dunlap12-Sep-03 13:55 
GeneralRe: #dev 0.97 released Pin
leppie12-Sep-03 14:41
leppie12-Sep-03 14:41 
GeneralI would like to refine an array. Pin
mcgahanfl12-Sep-03 9:42
mcgahanfl12-Sep-03 9:42 
GeneralRe: I would like to refine an array. Pin
Ernesto Perales Soto12-Sep-03 13:18
Ernesto Perales Soto12-Sep-03 13:18 
GeneralRe: I would like to refine an array. Pin
Nnamdi Onyeyiri13-Sep-03 1:24
Nnamdi Onyeyiri13-Sep-03 1:24 
GeneralVSS Pin
yyf12-Sep-03 8:07
yyf12-Sep-03 8:07 
GeneralRe: VSS Pin
NetPointerIN12-Sep-03 8:25
NetPointerIN12-Sep-03 8:25 
GeneralRe: VSS Pin
leppie12-Sep-03 9:00
leppie12-Sep-03 9:00 
Questionwhat textboxes are on my form? Pin
.gonad12-Sep-03 7:45
.gonad12-Sep-03 7:45 
AnswerRe: what textboxes are on my form? Pin
Mazdak12-Sep-03 7:55
Mazdak12-Sep-03 7:55 
AnswerRe: what textboxes are on my form? Pin
mcgahanfl12-Sep-03 9:48
mcgahanfl12-Sep-03 9:48 
AnswerRe: what textboxes are on my form? [edited] Pin
leppie12-Sep-03 10:31
leppie12-Sep-03 10:31 
AnswerRe: what textboxes are on my form? Pin
David Stone12-Sep-03 10:31
sitebuilderDavid Stone12-Sep-03 10:31 
AnswerRe: what textboxes are on my form? Pin
mcgahanfl12-Sep-03 14:41
mcgahanfl12-Sep-03 14:41 
GeneralRe: what textboxes are on my form? Pin
.gonad14-Sep-03 10:35
.gonad14-Sep-03 10:35 
GeneralListBox control and Datasource Pin
KevinS7512-Sep-03 5:11
KevinS7512-Sep-03 5:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.