Click here to Skip to main content
15,886,799 members
Home / Discussions / C#
   

C#

 
GeneralCheck for the dialog box. Pin
tonu23-Jan-04 6:41
tonu23-Jan-04 6:41 
GeneralRe: Check for the dialog box. Pin
Heath Stewart23-Jan-04 8:26
protectorHeath Stewart23-Jan-04 8:26 
GeneralServer 2003 DDK, ZMODEM Pin
Shahin7723-Jan-04 5:51
Shahin7723-Jan-04 5:51 
GeneralRe: Server 2003 DDK, ZMODEM Pin
leppie23-Jan-04 6:01
leppie23-Jan-04 6:01 
GeneralRe: Server 2003 DDK, ZMODEM Pin
Shahin7723-Jan-04 6:31
Shahin7723-Jan-04 6:31 
GeneralRe: Server 2003 DDK, ZMODEM Pin
Heath Stewart23-Jan-04 6:38
protectorHeath Stewart23-Jan-04 6:38 
GeneralRe: Server 2003 DDK, ZMODEM Pin
leppie23-Jan-04 9:02
leppie23-Jan-04 9:02 
Generalneed to import weird C struct Pin
sammyh23-Jan-04 5:28
sammyh23-Jan-04 5:28 
I am trying to import some functions from an open source library(DLL).

//Here is the function definition in C/C++
PJ* pj_init(int argc, char **argv);

//Here is the PJ struct in a .h file
typedef struct PJconsts {
XY (*fwd)(LP, struct PJconsts *);
LP (*inv)(XY, struct PJconsts *);
void (*spc)(LP, struct PJconsts *, struct FACTORS *);
void (*pfree)(struct PJconsts *);
const char *descr;
paralist *params; /* parameter list */
int over; /* over-range flag */
int geoc; /* geocentric latitude flag */
int is_latlong; /* proj=latlong ... not really a projection at all */
int is_geocent; /* proj=geocent ... not really a projection at all */
double
a, /* major axis or radius if es==0 */
e, /* eccentricity */
es, /* e ^ 2 */
ra, /* 1/A */
one_es, /* 1 - e^2 */
rone_es, /* 1/one_es */
lam0, phi0, /* central longitude, latitude */
x0, y0, /* easting and northing */
k0, /* general scaling factor */
to_meter, fr_meter; /* cartesian scaling */

int datum_type; /* PJD_UNKNOWN/3PARAM/7PARAM/GRIDSHIFT/WGS84 */
double datum_params[7];
double from_greenwich; /* prime meridian offset (in radians) */

#ifdef PROJ_PARMS__
PROJ_PARMS__
#endif /* end of optional extensions */
} PJ;

I understand that I need to use DLLImport to import the function and [ StructLayout( LayoutKind.Sequential )] to create a clss representing the struct, but I'm clueless on the first 4 lines in the struct above:
XY (*fwd)(LP, struct PJconsts *);
LP (*inv)(XY, struct PJconsts *);
void (*spc)(LP, struct PJconsts *, struct FACTORS *);
void (*pfree)(struct PJconsts *);


XY and LP are simple structs
typedef struct { double x, y; } XY;
typedef struct { double lam, phi; } LP;

Any ideas?

Thanks,
sam






GeneralRe: need to import weird C struct Pin
Heath Stewart23-Jan-04 5:40
protectorHeath Stewart23-Jan-04 5:40 
GeneralRe: need to import weird C struct Pin
sammyh23-Jan-04 6:00
sammyh23-Jan-04 6:00 
GeneralRe: need to import weird C struct Pin
Heath Stewart23-Jan-04 6:08
protectorHeath Stewart23-Jan-04 6:08 
GeneralRe: need to import weird C struct Pin
leppie23-Jan-04 6:08
leppie23-Jan-04 6:08 
GeneralRe: need to import weird C struct Pin
sammyh23-Jan-04 8:27
sammyh23-Jan-04 8:27 
GeneralRe: need to import weird C struct Pin
leppie23-Jan-04 8:47
leppie23-Jan-04 8:47 
GeneralRe: need to import weird C struct Pin
sammyh23-Jan-04 9:25
sammyh23-Jan-04 9:25 
Questionhow do i enable directx? Pin
godzooky23-Jan-04 5:20
godzooky23-Jan-04 5:20 
AnswerRe: how do i enable directx? Pin
sammyh23-Jan-04 5:33
sammyh23-Jan-04 5:33 
AnswerRe: how do i enable directx? Pin
Heath Stewart23-Jan-04 5:35
protectorHeath Stewart23-Jan-04 5:35 
GeneralRe: how do i enable directx? Pin
godzooky23-Jan-04 6:13
godzooky23-Jan-04 6:13 
GeneralRe: how do i enable directx? Pin
Heath Stewart23-Jan-04 6:34
protectorHeath Stewart23-Jan-04 6:34 
GeneralRe: how do i enable directx? Pin
AllanC123-Jan-04 17:34
AllanC123-Jan-04 17:34 
GeneralNeed help from someone with C++ background Pin
J. Eric Vaughan23-Jan-04 4:39
J. Eric Vaughan23-Jan-04 4:39 
GeneralRe: Need help from someone with C++ background Pin
Heath Stewart23-Jan-04 5:17
protectorHeath Stewart23-Jan-04 5:17 
GeneralRe: Need help from someone with C++ background Pin
J. Eric Vaughan23-Jan-04 6:33
J. Eric Vaughan23-Jan-04 6:33 
GeneralRe: Need help from someone with C++ background Pin
Heath Stewart23-Jan-04 6:36
protectorHeath Stewart23-Jan-04 6:36 

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.