RB dll argument definition fails in Xojo

I have a dll function call with the following arguments (A, B, C) where Aand B are integers.
In Visual C++ for Windows, C is defined as an unsigned char, C[] = {0xf0,0x7e,0xf7};

In Real Basic, I treated C as a CString , dim C as CString = Chr(&hF0) + Chr(&h7E) + Chr(&hF7) without problems.
But in Xojo the dll returns an error that is caused by the C argument

Is this a bug in Xojo or should C be defined differently in Xojo?

[quote=70631:@Michael Bedesem]I have a dll function call with the following arguments (A, B, C) where Aand B are integers.
In Visual C++ for Windows, C is defined as an unsigned char, C[] = {0xf0,0x7e,0xf7};

In Real Basic, I treated C as a CString , dim C as CString = Chr(&hF0) + Chr(&h7E) + Chr(&hF7) without problems.
But in Xojo the dll returns an error that is caused by the C argument

Is this a bug in Xojo or should C be defined differently in Xojo?[/quote]

Don’t use CHR (as that gives you UTF-8 code points and what you really want is BYTES
Use CHRB

Use a Memory Block, pas it, and do the Declare as Ptr for argument C. That’s what I do for consistency’s sake, but I have a feeling there’s a better way.

And I know you are sending MIDI Sys-Ex, so my answer gets extra credit. =)

I always think of Strings as textual words. I know historically that Strings are data containers too, but I just can’t think of them that way. I feel Data is truly represented by Memory Blocks (or, said, Buffers), but history and convention argue against me. Oh well.

I’m not exactly sure if my answer is what you are looking for, though, you are saying that Xojo gives you a No Entry Point type of error?

Norman

ChrB worked perfectly.

But a follow up question: Where should I have looked for the proper way of translating unsigned char or, related: it worked in RB; is there a listing of important changes I should have consulted?

Thank you for you help.

Chr worked in RB because RB actually did the wrong thing in some ways.
This was one.
The LR from 2012r2.1 says

Syntax result=Chr(value) Part Type Description result String The character whose ASCII value was passed. value Integer The numeric value ("code point") of the character you want, in the range 0-127.

Chr( > 127) returns … well … what ? its NOT ASCII nor did it throw an error
Chr is defined in terms of ASCII - and there are NO ascii characters > 127 and so when that was corrected it broke a fair number of things that assumed that CHRB = CHR (which should only be true with values <= 127)

I’m not sure there’s any guide that says HOW to translate C to Xojo code

Most things are pretty straight forward BUT a C “char[]” is a “run of unsigned char” (usually) and this is JUST bytes - hence chrb which is BYTES