.dll file generation issue

Hinal Modi

Member
Joined
Oct 17, 2022
Messages
15
Programming Experience
1-3
Hello,

I have developed an app in iOS and I need to create .dll file to develop app in xamarian.iOS. For that purpose I convert my app to

Objective-C static Library to generate .a FAT file , after generating .a file I have created Xamarian.iOS application that uses binding

which includes all our functions and classes. After including binding when I run the project it gives me thousands of error. Even after solving

all this error my trampoline.g.cs file if shown broken.Can anyone help me with this?

Thanks In Advance
 

Attachments

  • error.png
    error.png
    118.8 KB · Views: 28
The main code is in objective-C and sharing that won't be useful. I have shared the code where the problem is occurring
in post #9 and have shared the helpful document in post #11.
 
Last edited:
There is definitely a communication barrier here. I'm not asking you to share all your code. I'm only suggesting that you share the parts that you need help with as you manually fix the issues. You only need to share parts of the StructsAndEnums.cs and/or the ApiDefinitions.cs files that you need help with fixing. For us to understand how to help you fix it, we'll need to understand what native API it is calling, hence also the need for the documentation about the API.

For example, you could have shared with us:
C#:
// extern unsigned int __builtin_bswap32 (unsigned int)  __attribute__((nothrow)) __attribute__((const));
[DllImport ("__Internal")]
[Verify (PlatformInvoke)]
static extern uint __builtin_bswap32 (uint);

and then also shared with us the documentation for that __builtin_bswap32() function.
 
There is definitely a communication barrier here. I'm not asking you to share all your code. I'm only suggesting that you share the parts that you need help with as you manually fix the issues. You only need to share parts of the StructsAndEnums.cs and/or the ApiDefinitions.cs files that you need help with fixing. For us to understand how to help you fix it, we'll need to understand what native API it is calling, hence also the need for the documentation about the API.

For example, you could have shared with us:
C#:
// extern unsigned int __builtin_bswap32 (unsigned int)  __attribute__((nothrow)) __attribute__((const));
[DllImport ("__Internal")]
[Verify (PlatformInvoke)]
static extern uint __builtin_bswap32 (uint);

and then also shared with us the documentation for that __builtin_bswap32() function.
Thanks for explaining but the problem is I am not aware of this migrated code of C# from Objective-C. So the problem is from scratch , that I don't know this all code of C#.
 
Steps :
1) I already have an iOS app that I need to convert into a .dll file so that I may build it in Xamarian.iOS.
2) Create an .a FAT file by converting my app to an Objective-C static library.
3) I created Xamarian.iOS application after producing .a file. All of our classes and functions are used in the binding-based iOS application.
4) Using objective sharpie, I created the files ApiDefination.cs and Struct.cs.

Actual Result:
After implementing binding and adding new ApiDefination and Stuct files, the project gives me dozens of problems when I run it. Even after resolving all of these problems, my trampoline.g.cs file is still giving me errors.

This photo serves as a reference.


error.png


Expected Result:
Successfully produce .dll file that I can use with Xamarin.iOS without experiencing a single problem .

Reference Document : Walkthrough: Binding an iOS Objective-C Library - Xamarin

Video for Reference:

Software version:
Visual Studio for Mac: 8.10.25(build 2)
Xcode: Version 14.0.1
Visual Studio code : 1.72.2

Environment:
MacOS Monterey Version 12.6
 
There is no need to open another thread about the same problem. Merging threads...
 
Why you were expecting that comment out the code that was causing errors would lead to a usable trampoline.g.cs?
 
Show us the contents of this file and the specific errors. Please post those as text in code tags, not as a screen shot.
 
I believe trampoline.c.gs is a system file
In the .NET world, files with the extension of .g.cs or .g.vb are automatically generated files. I believe that I noted earlier in this thread that there were known issues in older versions of the tools.
 
Show us the contents of this file and the specific errors. Please post those as text in code tags, not as a screen shot.
C#:
Error: Trampolines.g.cs(25,25): Error CS1056: Unexpected character '`' (CS1056)
code that causes the error :
C#:
if (del != null)
                    del ((System.Action`1[Foundation.NSArray`1[lttsNavigationSDK.UIMenuElement]]) Marshal.GetDelegateForFunctionPointer (obj, typeof (System.Action`1[Foundation.NSArray`1[lttsNavigationSDK.UIMenuElement]])));
            }
This is a one in a hundred mistake.
 
Last edited by a moderator:
Looks like the bugs in generating the trampoline.g.cs are still present. The error is correct that the backtick character is unexpected. In fact, it not valid in C# except within strings.
 
Looks like the bugs in generating the trampoline.g.cs are still present. The error is correct that the backtick character is unexpected. In fact, it not valid in C# except within strings.
How do we handle this? Since I am not an expert in C#, I cannot fix this kind of issue.
 
You don't need to be an expert in C#. You just need enough knowledge to understand what those backtick followed by a number represent. Considering how much more complex Objective C is compared to C#, the learning curve should not be to steep.
 
You don't need to be an expert in C#. You just need enough knowledge to understand what those backtick followed by a number represent. Considering how much more complex Objective C is compared to C#, the learning curve should not be to steep.
How am I able to resolve and escape this problem, please, in the shortest and clearest terms possible? Are you able to assist me with this, or do you know of anyone else who might, it would be very appreciated.
 
Back
Top Bottom