On 15-Nov-18 10:36 AM, paul.blero wrote:> Hello,
I have somme problems to insert in my program non windows Api.
This is the first time I do that and I'm a little lost
I'm still working with Clarion 6.3.
I used libamker to create .lib file.
I included this .lib in my project structure.
OK, that's right so far
Now, I try to prototype some functions with complex structure
First problem :
typedef struct {
int version; // version of the symbol
int width; // width of the symbol
unsigned char *data; // symbol data
} QRcode;
For me it is
QRcode group,type
version long
width long
data *byte
end
But I have an error when I compile the program (*byte).
Yes. "unsigned char *data" is a pointer to data of type 'unsigned char'
aka byte. But CW doesn't have the concept of a data pointer type.
I have to admit I have a terrible habit of prototyping any type of
pointer as a ulong, but it works for me.
So, when you have to get creative:
QRcode group,type
version long
width long
data ulong
end
Then you have something like:
fred byte,dim(100)
code
fred = ! whatever
qrcode:data = address(fred)
Second problem - prototyping the functions :
What's the calling convention? It's not the CW internal one, it'll
either be C or Pascal
So you'll need the relevant thing on the end of your prototype
int CreateStaticQRCode(LPCWSTR posId, QRcode **qrCode);
CreateStaticQRCode(ulong,ulong),int,c
OR
CreateStaticQRCode(ulong,ulong),int,pascal
The **qrcode implies a pointer to a pointer to some data.
Which is wierd, but not entirely unheard of.
Assuming I'm right, off the top of my head it might be something like this:
fred dim,byte(100)
ptr1 ulong
ptr2 ulong
code
fred = ! whatever
ptr1 = address(fred)
ptr2 = address(ptr1)
returnedvalue = CreateStaticQRCode(100,address(ptr2))
int SaveQRCodeAsBitmap(QRcode *code, int pixelSize, LPCWSTR filePath);
Same concept:
SaveQRCodeAsBitmap(ulong,ulong,ulong),int,C
fred like(qrcode)
filename cstring(300)
code
fred = ! whatever
filename = 'c:\fred.bmp'
returnedvalue = SaveQRCodeAsBitmap(address(fred),100, address(filename))
hth,
Paul
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)