Xamarin ios - import library - ios

I need help importing a library to Xamarin. I included the library and inserted it into a new folder named BarcodeScanner, and the name of the library is libBarcodeScanner.a.
gcc_flags "-L${ProjectDir} -lBarcodeScanner -force_load ${ProjectDir}/libBarcodeScanner.a”
But it shows an error:
Error: Could not parse additional mtouch arguments: No matching quote found.
What should i do ?
Do i need to create a binding project to use a library like BarcodeScanner ?

Error: Could not parse additional mtouch arguments: No matching quote found.
That does not look like a Xamarin.iOS (mtouch) error message. Those start with a MT prefix followed by 4 numbers, e.g. MT2001. Could it be Xamarin Studio giving you this error ?
What should i do ?
Review the flags: are they identical to what's pasted above ?
No matching quote found. makes is sound there's an extra quote in there. Maybe one of the " is wrong (e.g. a autocorrection giving you a smart quote) ?
Or maybe your project directory (replaced from ${ProjectDir} contains a quote character ?
Also can you edit your question to add which version of Xamarin Studio you're using ?
Do i need to create a binding project to use a library like BarcodeScanner ?
No, but it's the preferred ways to link static libraries. Using a binding project removed the need to add Additional mtouch arguments inside every projects and every build configuration (e.g. Debug, Release...) of your applications.

I will answer my own question, maybe it will help someone. I declared in my MainController that i needed:
using MonoTouch.CoreVideo;
using MonoTouch.CoreMedia;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreFoundation;
And after that i referenced only the static library with:
-gcc_flags "-L${ProjectDir} -lBarcodeScanner -force_load ${ProjectDir}/libBarcodeScanner.a"

#poupou's "maybe" was spot on, but I'll be pedantic and explain exactly.
Look closely at this line I just quoted from your original question. I've marked it down using code (four spaces prefix per line), and broke it into two lines. Nothing else has been changed. Hopefully the error should be obvious now:
- gcc_flags "-L${ProjectDir} -lBarcodeScanner
-force_load ${ProjectDir}/libBarcodeScanner.a”
Essentially, you used different types of double quotes. The first double-quote character above is Unicode 0x0022, which is the regular Quotation Mark. The second double-quote character above is Unicode 0x8221, or Right Double Quotation Mark. It might be that you had copied & pasted all or part of the line above from a web page, rather than typing it in.
For command-line processing, mixing your styles of double quotes simply won't work. You'll need to use balanced regular quotation marks, as you wrote in your own answer just now (but might not have specifically noticed?) FWIW, the right- and left- variants of the quotation mark are usually used for word processing, web pages, etc. where the style aesthetic matters.
Since you didn't use code-markup when quoting that line originally (while I noticed you did, in your recently posted answer) it looks like Stack Overflow "helpfully" tried to render the quotes as similar in style, fooling us into looking elsewhere for the problem, when it was right in front of us.
Anyway, next time you get an error about mismatched quotes, I suggest you carefully check their type. If they look the least bit different, they may not be the right kind of quotes.

Related

Microsoft Visual Studio extension (VSIX) lower case $safeprojectname$

Context
I'm developing a Microsoft Visual Studio extension, for which I've seen there are:
$projectname$ variable to get the name given to the project,
$safeprojectname$ variable to get the name given to the project with all unsafe characters and spaces replaced by underscore.
Source: https://learn.microsoft.com/en-us/visualstudio/ide/template-parameters?view=vs-2019
For example with project name "Tata yoyo" variables will be:
$projectname$ = "Tata Yoyo SWIG",
$safeprojectname$ = "Tata_Yoyo_SWIG".
The extension I'm building is for SWIG projects that will generate Java from C++, and in this context there is a swig.exe call that, among others, takes the Java package as parameter, for which I want it to be all lower case, but for now it is com.company.$safeprojectname$, then, not necessarily lower case (pointing the obvious: if project name is not lower case, package will not be lower case) and I then have to convert it manually to lower case.
What I'm looking for
From source page above (and other documentation pages) I've already seen there is no $lowercasesafeprojectname$ for example, then if anybody knows a way to do it from a function, script or any other way I would be glad.
Edit: while I want for this purpose a lower case safe project name I still want to keep the original $safeprojectname$, then even if #Ed Dore answer is relevant it is not the solution for me.
In any case, do not hesitate if this is not clear or you want more information.
Thanks
If you implement a custom wizard (IWizard) with your template, you can replace the respective token values in the ReplacementsDictionary passed to your IWizard.RunStarted method, with lowercased equivalents.
Sincerely,

Line control statement in swift

i am reading swift from apple docs and learning about statements. but couldnot find any information about the Line Control Statements.
According to the docs
A line control statement is used to specify a line number and filename
that can be different from the line number and filename of the source
code being compiled. Use a line control statement to change the source
code location used by Swift for diagnostic and debugging purposes.
A line control statement has the following forms:
#sourceLocation(file: filename, line: line number)
#sourceLocation()
My question is when should i use it? The docs lags an example about the topic.Any links or some hints would be helpful.
This isn't the sort of thing you'd ever need as a beginner, and you could probably go through an entire career without using it. It seems to be meant for use in tools that generate source code. See the comments in the original feature proposal for the complete story.
TL/DR: Don't worry about it, you'll never need it.

carat and New line issues using NHAPI tool in .NET

I'm using NHapi v22 tool for sending HL7 messages. Issue is I'm not able to create component separator(^) and new line. Please tell me how to code for it in C#.
Following is the code:
MSH|^~\&|xyz|xyz|FLOW|FLOW|201601201525||ADT\S\A04|201601201525123456789|P|2.3|||NE|NE
I need to get like this- ADT^A04
I believe the issue here is that \S\ is an escape character for ^ (component separator). Your message should contain an actual component separator with the actual ^ in it, not the escape character.
"ADT" should appear in MSH-9-1 and "A04" should appear in MSH-9-2 as opposed to how I suspect you are doing it with "ADT^A01" in MSH-9.
Does this help? Please feel free to contact me directly if you need more specialized advice.
edit: I don't normally use NHapi but I suspect you may need to do something along this line:
terser.set("/MSH-9-1", "ADT");
terser.set("/MSH-9-2", "A01");
as opposed to something you might be doing
terser.set("/MSH-9", "ADT^A01");

Localizable string in Foundation.framework not found

I'm getting this log warning while using my app and I'm not sure how to deal with this message:
2014-10-21 12:57:54.472 App[7067:2540152] Localizable string "(A Document Being Saved By %#)" not found in strings table "Document" of bundle CFBundle 0x12e508f60 (not loaded).
It seems, the localization file within the framework is missing, which would be really weird. Re-adding the framework didn't help.
Any hints apprechiated.
I'm getting the same message. In my case it looks like both TestFlight and Crashlytics are generating them;
[TestFlight takeOff:#"xxxxxxxxxxx"]; // Generates 2 messages
[Crashlytics startWithAPIKey:#"xxxxxxxxxxx"]; // Generates 1 message
Not causing us any trouble, so leaving them alone for now.
Update
Ok, got to the bottom of it. If you've been doing localization, chances are you probably enabled 'Localization Debugging' in your scheme (Product > Scheme > Edit Scheme in Xcode). If you're wondering why you're getting these messages from the various libraries, it's probably because you still have it enabled.
I just had this problem too.
Since turning off the warning seems like a bad idea (Feels like high risk translations will not work as intended), I tracked down what actually caused the problem.
In my case, the problem was an empty string in the Localizable.strings file. (I used a non-standard way to generate it, the default genstrings tool will not add them)
That is, in one place I had this line:
/* No comment provided by engineer. */
"" = "";
If I removed it, the warning disappeared!
Seems like there is some problem in the string table implementation if you add empty strings, that makes all string tables mess up, not only the one where the problem is...
Maybe someone will find this information useful, so I leave it here.
If you don't specify "Document" then it will look in the file Localizable.strings. Otherwise make sure you have the file Document.strings in your project. Also, "(A Document Being Saved By %#)" looks pretty weird to me. You might want to check this is really what you want as a key for a localizable string.
Here is a link that may help you understand the process
https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html
From what i found in my recent project, this error occured when you have the english language (just english with no region) defined in your device.
Since one or more framework will fail to find translation strings you will have this error in your console log.
Hope that helps
Another common mistake is the forgotten ";" at the end of any line in the file, that holds your Localizable.strings. This can easily happen after massive copy and paste. Unfortunately it is not easy to locate, because the compiler does not complain with a line number or any other helpful hint. This can be very painful and tedious, when you have big localizable tables.
The result of that mistake will be, that some translations are found, others not and its hard to find the reason.
My solution to make sure, all keys are proper defined (with the ";" at the end of the line):
Open your file "Localizable.strings" in Xcode
Delete the lower half of the table (for a start)
Press COMMAND + B (build)
If you don't get an error, the problem must be in the deleted lower half. Paste it back, delete now only the lower 25 % and repeat build. Repeat the process until you can better locate the problem.
Looked all over StackOverflow looking for a solution.
And found a mistake.
I just duplicated the localization, for example:
let str = "String".localized
After that, as well:
str.localized
And after that I claim
[strings] ERROR: String not found in table Localizable of bundle
CFBundle 0x14bd01fc0

Delphi - unmangle names in BPL's

Is it possible to unmangle names like these in Delphi?
If so, where do I get more information?
Example of an error message where it cannot find a certain entry in the dbrtl100.bpl
I want to know which exact function it cannot find (unit, class, name, parameters, etc).
---------------------------
myApp.exe - Entry Point Not Found
---------------------------
The procedure entry point #Dbcommon#GetTableNameFromSQLEx$qqrx17System#WideString25Dbcommon#IDENTIFIEROption could not be located in the dynamic link library dbrtl100.bpl.
---------------------------
OK
---------------------------
I know it is the method GetTableNameFromSQLEx in the Dbcommon unit (I have Delphi with the RTL/VCL sources), but sometimes I bump into apps where not all code is available for (yes, clients should always buy all the source code for 3rd party stuff, but sometimes they don't).
But say this is an example for which I do not have the code, or only the interface files (BDE.INT anyone?)
What parameters does it have (i.e. which potential overload)?
What return type does it have?
Is this mangling the same for any Delphi version?
--jeroen
Edit 1:
Thanks to Rob Kennedy: tdump -e dbrtl100.bpl does the trick. No need for -um at all:
C:\WINDOWS\system32>tdump -e dbrtl100.bpl | grep GetTableNameFromSQLEx
File STDIN:
00026050 1385 04AC __fastcall Dbcommon::GetTableNameFromSQLEx(const System::WideString, Dbcommon::IDENTIFIEROption)
Edit 2:
Thanks to TOndrej who found this German EDN article (English Google Translation).
That article describes the format pretty accurately, and it should be possible to create some Delphi code to unmangle this.
Pitty that the website the author mentions (and the email) are now dead, but good to know this info.
--jeroen
There is no function provided with Delphi that will unmangle function names, and I'm not aware of it being documented anywhere. Delphi in a Nutshell mentions that the "tdump" utility has a -um switch to make it unmangle symbols it finds. I've never tried it.
tdump -um -e dbrtl100.bpl
If that doesn't work, then it doesn't look like a very complicated scheme to unmangle yourself. Evidently, the name starts with "#" and is followed by the unit name and function name, separated by another "#" sign. That function name is followed by "$qqrx" and then the parameter types.
The parameter types are encoded using the character count of the type name followed by the same "#"-delimited format from before.
The "$" is necessary to mark the end of the function name and the start of the parameter types. The remaining mystery is the "qqrx" part. That's revealed by the article Tondrej found. The "qqr" indicates the calling convention, which in this case is register, a.k.a. fastcall. The "x" applies to the parameter and means that it's constant.
The return type doesn't need to be encoded in the mangled function name because overloading doesn't consider return types anyway.
Also see this article (in German).
I guess the mangling is probably backward-compatible, and new mangling schemes are introduced in later Delphi versions for new language features.
If you have C++Builder, check out $(BDS)\source\cpprtl\Source\misc\unmangle.c - it contains the source code for the unmangling mechanism used by TDUMP, the debugger and the linker. (C++Builder and Delphi use the same mangling scheme.)
From the Delphi 2007 source files:
function GetTableNameFromSQLEx(const SQL: WideString; IdOption: IDENTIFIEROption): WideString;
This seems to be the same version, since I also have the same .BPL in my Windows\System32 folder.
Source can be found in [Program Files folders]\CodeGear\RAD Studio\5.0\source\Win32\db
Borland/Codegear/Embarcadero has used this encoding for a while now and never gave many details about the .BPL format. I've never been very interested in them since I hate using runtime libraries in my projects. I prefer to compile them into my projects, although this will result in much bigger executables.

Resources