1. Re: Wrappers

One thing that has me wondering about a solution involves a situation like
:-

__declspec(dllexport) int MORFIT_WINAPI Morfit_engine_3D_edge_to_2D(double
p1[3], double p2[3], int p1_2D[2], int p2_2D[2]);


The double p1[3] ' s  or whatever are what I'm not sure how to solve. You
can't tell from the C include whether or not they are inputs or outputs from
the function....you have to know the function. It's hard to know the
function when you're not intimate with the DLL! Am I right in thinking that
the VB include marked such arrays as "for input" or "for output"??

Solutions?

1. treat every one of these as potentially input or output. this I figure
will lead to more inputs and outputs from the wrapper function than is
necessary. - I don't like this idea

2. get the wrapper program to query the user every time it encounters one of
these about whether to treat it as  input or output- I can't think of any
other way.

Any ideas anyone?

As David said, there is a lot of complexity in this that doesn't immediately
spring to mind. eg.

1. How do you handle functions that return pointers to strings? Do you
return the pointer or the string? If you return the string do you strip the
NULL terminator from the string?

2. Do you require the user to set up pointers for the functions of the DLL
in their program (eg pointers to strings, pointers to arrays) or do you do
it in the wrapper function.

3. As Euphoria returns values from functions in a sequence, do you return
multiple returns from the function (return values that the DLL functions
just return at pointers)  in a sequence or do you just return the ACTUAL DLL
function return and require the user to peek the pointers for the values (of
course, they would have to KNOW the pointers which means  at #2 above, they
probably had to allocate their own space. If you return multiples in a
sequence, what return order (doesn't seem important until you try it)?

I think I know how I'm going to do the Morfit wrapper program (Todd's
methods plus the other solutions we came up with) but to make it more
general you need to be able to cover all the little problems like above.

Any more thoughts anyone?


----- Original Message -----
From: David Cuny <dcuny at LANSET.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Saturday, March 18, 2000 5:56
Subject: Re: Wrappers


> I've started (but not completed) a program to generate wrappers from a C
> include file. It's a two-step process. The first pass runs the
pre-processor
> directives and creates a 'plain' C file. The second pass converts
structures
> and declarations to Euphoria equivalents.
>
> Anyone interested in taking this project on? There are a *lot* of subtle
> problems to be solved, especially with type conversions.
>
> -- David Cuny

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu