Page 1 of 1

structures in external function calls

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Kern Carboni >> Wed, 13 Jan 1999 2:30:49 GMT

When calling an external windows function from jade which requires a C structure type as a parameter, what would be the jade equivalent of the
C structure?

Regards
Kern

Re: structures in external function calls

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Craig Shearer >> Wed, 20 Jan 1999 23:22:41 GMT

Hi Kern

Well, JADE doesn't have an equivalent of a C Structure, but you can easily mock one up.

The Binary primitive type has a bufferAddress method which returns the address of its storage in memory, so you could create a binary large enough to hold the data then pass it to your Windows API function by getting its address.

While accessing the members of the structure is going to be a pain (you'd probably have to access each individual byte out of the binary to get the data you want), at least it is possible. You could always write a small DLL to take the binary and split it up into its component parts.

Give it a whirl, and let us know how it goes.

Craig.

Re: structures in external function calls

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Roger Parkinson >> Mon, 22 Mar 1999 17:15:58 GMT

You almost certainly will find it easier to pass a list of parameters and pack them into the structure from the C code.

Re: structures in external function calls

Posted: Fri Aug 07, 2009 11:39 am
by ConvertFromOldNGs
by Wilfred Verkley >> Tue, 23 Mar 1999 23:59:43 GMT
You almost certainly will find it easier to pass a list of parameters and pack them into the structure from the C code.

Wouldnt it be great if you could do that with kernel32.dll :-)

We often end up writing an OCX in VB that simplifies the interface between jade and any external components or code we need to call.