.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: 8
*sigh* Just dumping ALL of your code like that is not very helpful. It doesn't really motivate anyone to try to help you.

Anyway, C# syntax is to like C or C++. You can't declare a method with just the parameter types like you do below:
C#:
static extern uint __builtin_bswap32 (uint);

The error that comes back is correct and accurate:
C#:
CS1001    Identifier expected

And the following is not valid C#:
C#:
static extern int __fpclassifyl ([unsupported Builtin: long double]);

Again, the errors that come back is correct and accurate because the compiler doesn't know what to do with that line:
C#:
CS1003    Syntax error, ',' expected
CS1001    Identifier expected
CS1003    Syntax error, ']' expected
CS1001    Identifier expected
CS1003    Syntax error, ',' expected
CS1001    Identifier expected
CS1002    ; expected
CS1026    ) expected
CS1519    Invalid token ']' in class, record, struct, or interface member declaration
Thanks for your response, but let me clear one thing I am not C# developer I am an iOS developer and I want to make it clear that I need to generate .dll file hope that is clear to you too. Now lets come to my code and I have told in my one of the post that the generated code is not coded by me and its generated from Objective-C static Library i.e (.a) file generated in Xcode.

This the document which I followed , I need to know why the code generated is giving me this all errors , is anyone there with this answer.
Please note:Code is been generated from Static Library and not manually coded.The project is made in Objective-C.Please go through above link.
 
Last edited:
See:

In some cases these generated files might be all you need, however more often the developer will need to manually modify these generated files to fix any issues that could not be automatically handled by the tool (such as those flagged with a Verify attribute).

In other words, the tool can't do everything for you. You'll need to manually fix the manually generated files.
 
See:



In other words, the tool can't do everything for you. You'll need to manually fix the manually generated files.
Thanks for the suggestion.
I have tried to solve it by myself but that lead me to breaking system files.Can you help me solve this errors manually.If you can that would be a great help to me.
 
I am actually anti-Apple. I don't believe in their closed garden approach. I grudgingly have a MacBook for work, an iPad for my kids school, and an iPhone to manage that iPad (for a child) because apparently you can't do parental controls on an iPad and have it as a standalone device.

Hopefully someone will help you.
 
Last edited:
I think that if you post some of the relevant bits of code bit by bit, as well as documentation about what native APIs those methods are mapping to, we might be able to help you one step at a time, and teach you what C# is expecting to see vs. what the underlying API offers up.
 
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...
 
Back
Top Bottom