Calling MonoTouch Library from Objective-C - objective-c

I am using this article as a guide to call into a MonoTouch library from within an Objective-C application. We have an existing iPhone application and an existing c# library which we need to bring together. We have considered re-writing the iPhone app (Objective-C) in MonoTouch, but we do not have the time right now. We need a way to use our MonoTouch library from the iPhone/Objective-C app.
My problem is, the Xcode project generated by calling mtouch cannot be compiled. It cannot find the mono header files and the .s files referenced by the project are not found because they are instead named with a .6.s extension. Am I running mtouch incorrectly? If not, how can I tell the Xcode project where the mono header files are located so it can compile? Also, how can I set up the Objective-C code to call my MonoTouch library (the main.m file has some clues, but it does not appear to be straight-forward)?
Here are the type of errors:
error: mono/jit/jit.h: No such file or directory

Related

FileNotFoundException when referencing (managed) C++ Assembly from a C# Console App

I am in the process of writing a .NET wrapper for legacy native c++ code. My strategy is to write a CLR class library that wraps the native code.
To test whether the class library is functioning properly, I created two console apps in separate solutions:
A C++ CLR console app
A C# console app
Both of these contain the same simple test code to exercise the class library.
Both apps build as expected. The C++ app runs just fine, but the C# app is giving me a FileNotFoundException when it tries to load my class library.
I have a constraint that forces me to use VS2008 and .NET 3.5. Everything is built with Win32 or x86 configurations.
For both console apps, I am using a project reference to the class library.
In each case, builds copy the dll (and the intermediate files) to the same directory where each app is built.
I tried using the fusion log viewer, but logs are disabled on my machine and I do not have administrator privileges.
Has anyone ever seen this before?
Can someone please point me to a good site that outlines the differences between the way C# and C++ CLR apps load assemblies?
Since this is my first attempt to bridge C++ and C# I assume I am just making a simple mistake somewhere, but I am stumped as to what that is.
I have trolled the internet (including many SO postings) but have yet to find exactly what I need.
Thanks in advance,
Judd

What are *.dll.s files and what are they used for?

I am currently working on an iOS project using the Unity framework.
When I export an Xcode project from Unity, there are a whole bunch of files exported.
Besides some source files, there are also .dll files for the Mono project.
But there are also .dll.s files.
For troubleshooting, it would be great to know what they are used for.
There is one .dll.s file for every dll, so it could be some sort of source which is compiled into the dll?
When there are exceptions somewhere in the code, Xcode often jumps into one of these .dll.s files and it looks as if they contain some sort of assembly code.
Directions would be nice, Google isn't really helpful here ...
TIA,
best regards,
Flo
They're the IL code in the dll files compiled into arm assembly. This is the code that eventually end up in the final app binary.

Linking the new Google Api To Xcode 4

I am fairly new to xcode and objective C in general, but have done a fair share in Microsoft.Net and visual studio.
I have just check out the latest google api objective c project. I am looking to add this as a static library to my xcode 4 project.
What i have done:
Add the project file to my existing project.
Link up the dependency on my project build phases
Under Build settings, I have enter -ObjC -lxml2 -all_load
I have build it without error. By running Shift + B.
But my issue is that when i try to enter #import "GTLTasks.h" i get an error no such file or directory.
Do i have to add the respective Service by itself? If so where should i add the files to the GTLxcode.project or my own project?
The service i am talking about is located in the following path source/services/
Sorry if i doesn't make sense as I am still exploring around in xcode and objective c.
Just for the record, I have managed to resolved this issue.
Under the Build Settings of the xcode project, Other linker flags
-ObjC -all_load
Followed by Header Search Paths
$(SRCROOT)/YourFolder/
Where your project folder is located this is where you will place your source files from google.

Frameworks for static libraries xcode

I have just added a linked library to my project using the question here Process for linking static ObjC libraries in XCode and the document linked to in the answer.
I happen to know the library uses CoreData objects, like NSManagedObject, although in the library's xcode project the CoreData framework isn't added and it builds with no errors. However when I build my app it comes up with several errors such as:
Undefined symbols:
"_OBJC_CLASS_$_NSManagedObject", referenced from:
_OBJC_CLASS_$_AClass in library.a(AClass.o)
So seeing as all the errors mentioned CoreData objects, I added the CoreData framework to my app and it built successfully.
So now I tried remove CoreData framework from my app and added it the libraries project and them built both and it failed.
So why does it work when I have coredata added in my project but not in the libraries project, and only the library uses it?
(and why does the library build without needing the coredata framework on its own?)
The library is static. It is not a stand-alone piece of code, it must be linked.
Your application is linked, which means the linker resolves all the external dependencies and fills in the library functions' addresses in the final executable.
If you want to use a library that has a Core Data dependency in your application, you must link against Core Data.framework.
Adding a linking stage to a static library has no effect, since there is no linker involved in creating a static library, only a compiler (and an archiver).
Now, the problem can sometimes be avoided by using the new #import syntax in your libraries header file. The compiler will then automatically link against the used framework, even if you use a static library.

Copying dynamic library (.dylib) into a framework (.framework)

I have two XCode projects: a framework and a client application.
My application depends on my framework and everything works fine with that — the framework is being recompiled everytime the app is, the projects build paths are set correctly, it's completely okay.
Now the framework started using 3rd party dylib file, and it's linked against the dylib.
I've even added a build phase to copy that library into the framework's resources dir.
When i'm trying to run the application, everything compiles correctly, then i get this:
dyld: Library not loaded: /usr/local/lib/libplplot.9.dylib
Referenced from: /Users/railsmaniac/Projects/Study/Calculus of >approximations/Builds/Debug/XNMaths.framework/Versions/A/XNMaths
Reason: image not found
How can i fix it?
Adding the library into client application's resources doesn't fix the problem.
I can just place the library into the required location, but i prefer to keep it IN the framework.
Is it possible?
It looks like your application is expecting the library to be found at a specific path on the system. If you are on OS 10.5+ you can use the new #rpath functionality to allow your application to link dynamically to your library.
See this post for further details. It also shows the "old" way of doing this.