C++ Builder TArray<System.Byte> not compiling - udp

I'm trying to include the idUDPServer component (Indy component) in a C++ Builder XE project and when I try to include the onUDPRead event (manually linking it to the component because of a known bug in C++ Builder XE).
All articles I have read so far solves this problem by manually assign the event function to the component.
In my case I can't compile because it can't recognize the TArray<System.Byte> parameter.
I have tried to include the <System.hpp> but it doesn't help.
Is there anyone that has managed to solve this issue with TArray?
Function declaration:
void __fastcall UDPServerUDPRead(TIdUDPListenerThread *AThread, TArray<System.Byte> AData, TIdSocketHandle *ABinding);
Thanks in advance...

Okay, I solved it.
I remembered that I had successfully upgraded an earlier project using the idUDPServer control without any problem. So why did that code compile and not this new one?
After some research I found that apparently Delphi (I know, it's weird. C++ Builder is written partly in Delphi) solves all types to its base form and there is an issue with the TArray<System.Data> type.
I copied the declaration from the converted project:
void __fastcall UDPServerUDPRead(TIdUDPListenerThread *AThread, TIdBytes AData, TIdSocketHandle *ABinding);
As you can see the TArray<System.Data> is replaced with TIdBytes. It compiles without any warnings or Errors. You still have to assign the event function manually although (in the Create Event).
UDPServer->OnUDPRead = &UDPServerUDPRead;
* EDIT *
Updated code TBytes to TIdBytes as Remy Lebeau - TeamB corrected me.

Related

abc bytecode decoding failed

I am working on a project in Flex 3.
First off, I should explain I'm learning Flex as I go along. I was tasked with figuring out something and I needed Flex to do it as that is what our UI guys do (I am a database developer and work in PL/SQL and minimal ColdFusion).
What I'm trying to do is create a PDF, and I was able to get this to work on my local machine with a simple program using Flash Builder 4.6. It grabs a snapshot of an object and turns it into a PDF with no issues.
When I move this to Flex 3, I get issues. The error I am getting is:
abc bytecode decoding failed.
I tried to refresh and clean the project per some google searches suggestions, but that did not fix anything.
My code looks like this:
public function pdfBtn_printPDF(event:MouseEvent):void
{
Alert.show("Hello!");
}
Starting with an alert box to verify the function works perfectly. With my full function code or even if I replace it with just the following:
public function pdfBtn_printPDF(event:MouseEvent):void
{
var createPDF:PDF = new PDF(Orientation.PORTRAIT, Unit.MM, Size.A4);
}
I get the error above and my project won't work. I am at a loss as to what I am missing. am I creating the variable wrong? If I create it outside of the function it still gives me the decoding error and I have verified that I am creating the variables like other variables inside this project.Any help would be appreciated!!
The issue was I had compiled a library in Flash 4.6 and it wasn't compatible with Flex 3. It is working now with a new library.

Swift init with closures is not visible in Objective C

My swift custom initilizer with closure is not visible in the objective c code.
init(url:String,request:ABaseRequest,
type:AnyClass, success:(ABaseResponse)->Void,
failure:(ResponseCode,NSError)->Void) {
......
......
}
where as init without closure is visible
init(url:String,request:ABaseRequest,type:AnyClass) {
......
......
}
Do you guys know how to solve this issue?
After inspecting whole code I found the problem in my code. A class used inside my closure is not annotated with #objc ! . So be careful guys, each and every classes that is going to be exposed to objective c should be annotated with #objc. Thanks.
By now you may have already solved the problem. I've run into a similar one myself.
Unless there are other problems, the visibility issue can be fixed by trying to build the project. If you introduce something new in your Swift code, it may not be immediately visible to Objective-C code, but building the project should fix it.
If there is another problem related to your custom initializer, the compiler will tell you when you try to build. If that is the case, share the problem here.

Why doesn't Xcode suggest #synchronized?

I only rarely use #synchronized, but as far as I can remember (meaning around Xcode 3.2 or something), it never suggested #synchronized when using the auto-completion, and still never does.
I do get suggestions when typing '#', like #autorelease, #encode, #selector and so forth.
Is there any known reason for this ? I wasn't able to find any related topic. It's been bugging me, because it gives me the feeling that this is not a valid method to handle concurrency in iOS.
#synchronized does not appear when using auto-completion because Apple has not mapped that keyword to any code sense implementation.
Per Apple's suggestion, I have filed a bug report.
However, I can offer an auto-complete solution.
You may create an #synchronized snippet that can be auto-completed or drag and dropped into your code.
Copy/paste the code below into one of your Xcode documents.
Select the new code and drag it to your snippets library.
Double-click the new snippet and click edit.
Enter #synchronized for the completion shortcut.
For more info: http://nshipster.com/xcode-snippets/
#synchronized(anObj) {
// Everything between the braces is protected by the #synchronized directive.
}

Project to project reference - type not CLS compliant

I have a problem regarding a public declaration in one project which makes reference to a class in a different project.
The parent project references the dependent project without problem. However, I'm getting a warning that Type member 'user' is not CLS-compliant. It's declared as
Public user As User
this declaration is made in the parent project. User is a class in the supporting project
I can use the type on a form without fail. Now, I try to pass it off on another form - in the parent project:
Private oldUser As User
oldUser = frmUserMgt.user
and the thing crashes. Stepping through the code shows oldUser is nothing.
I built a brand new solution and tested this exchange without fail. I've searched solution and project settings until I'm blue in the face and can't find a difference. It's a VS2012 VB solution. I can post as much code as needed if the above description isn't sufficient - any help will be greatly appreciated.

Expected function body after function declarator error

I downloaded the class files and demo program here: http://github.com/matej/MBProgressHUD
When I try to compile the program, I get several errors. The first one appears here:
CG_EXTERN void CGPDFContextAddDocumentMetadata(CGContextRef context,
CFDataRef metadata) CG_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_0);
On the second line the error is "Expected function body after function declarator."
What's wrong with this code? How can it be fixed?
In the project build settings, change the compiler version to the system default.
If you have access to Apple's Dev Forums for the Xcode betas, you can find more info and an alternative solution at https://devforums.apple.com/message/287160#287160.