Using Novell.Directory.Ldap in Mono (For Android and Touch) - mono

I want to use the Novell.Directory.Ldap library in a MonoTouch and Mono For Android project.
http://www.novell.com/coolsolutions/feature/11204.html
When I compile my project in iOS simulator modus, It compiles without errors and runs correctly (in the iOS simulator).
When I compile my project in iOS device modus (to test the app with a physical device), I get this error:
Error MT2002: Failed to resolve "System.Void System.Security.Cryptography.RNGCryptoServiceProvider::.ctor(System.Byte[])" reference from "mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" (MT2002) (MyProject)
How could I solve this problem? I can't find a solution.
Should this library work for MonoTouch and Mono For Android?
Are there better LDAP solutions for Mono?
UPDATE: I just tested it with Mono For Android. This works fine.

There's three questions in there, so I splitted my answers in three. Please read all of them :-)
How could I solve this problem?
This is a general problem with a general solution to solve it.
The code you compiled is including a reference to "mscorlib, Version=1.0.5000.0
That's likely because you did not use the compiler provided with Xamarin.iOS (MonoTouch), named smcs, to build the assembly. That compiler would set the references to use the right mscorlib.dll assembly (and report anything missing in the MOBILE profile).
The fact that it can work for Xamarin.Android is that it uses the JIT (just in time compilation), so missing members won't be found before runtime (and if execution reach that code).
OTOH Xamarin.iOS uses AOT (ahead of time compilation) since JIT'ing is not allowed (by Apple) on devices. That means missing members are found at build time. In this case the (managed) linker can't find the reference and issue the MT2002 error.
So the solution is to re-build the assembly using smcs and fix, if any, build time errors. E.g. IIRC that RNGCryptoServiceProvider ctor is not available (and does nothing since seeding is not possible) and should be replaced with the default ctor.
Should this library work for MonoTouch and Mono For Android?
It should. However my personal experience with Novell.Directory.Ldap was not really good (code and design issues, e.g. threading, in particular with SSL enabled).
Also the code has not been updated for quite a while. You might be better served at looking at (managed or native) alternatives for your LDAP needs.
Are there better LDAP solutions for Mono?
Sadly I have not used any other similar library so I can't suggest alternatives (but maybe other people will be able to help).

The problem is solved.
Instead of using the dll from Novell, I downloaded all the source files of the Novell LDAP library and put them into a new library project. Then I made a reference to that library from my own Mono project.
While compiling my project and the library project, I received some errors from the library project. After solving these errors manually, it works fine for both (MonoTouch and Mono for Android).

Related

LWIP library files not building on Atmel 7.0 when setting NO_SYS=1

I've got a strange question that I can't seem to find any answers for. I'm building a quite simple application for sending/receving data from/to a PCB, and the application itself builds, but when I exited Atmel Studio (Version 7.0) and reopened the project, the library files no longer built. At least that's what I think happened. I didn't change any code between building the project before and after restart of the program. It has happened before, and that time I solved it by creating the project from scratch, but I'd really like that not to be the only solution. I've also tried restarting the program again, as well as the computer. I also removed and re-added the library.
Has anyone encountered the same issue? If so, any help in the right direction would be greatly appreciated. Information on my system and error messages below:
I'm building for the ATSAMV71N21B board, with Atmel Studio 7.0. I've imported the lwip library trough the ASF wizard, and these files built before the program restart.
These are the files that won't build:
The 122 build errors mainly consists of "expected expression before 'struct'" and undeclared functions and variables, even though these clearly are defined in the various files in the library.
It ended up being because of my NO_SYS setting being 1. When I switched it to 0, everything built, (except for sys_check_timeouts(), but I think I'll find another answer for this). Keeping this here for reference if anyone needs it one day.

Including Missing DLLs

I am developing in DX 10/11, & when I tried the code on another computer with a NV 660, it said that d3dx11d_43 was not found. I reinstalled the Visual C++ 2012 32/64 bit & DirectX Runtime, but still says that. I think that the user needs to install the SDK or something.
I get the warning that the debug info cant be found.
From what I have reading, it is because I have something that depends on something debug related. No idea what though.
Is there a way to make the game compile with most, if not all, of the DLLs? I dont mind the extra size. The content of many games out-weigh the extra DLLs that are used.
I did compile as Release.
Edit:
Removed 1st question, since no one answered it.
You can add the dlls you need to the resource file, then compile the resource file to your exe file, and at last, parse the resource file at run time to get the dlls you need. here is a similar question, you can take a look.
d3dx11d_43 is a debug version of d3dx11_43 which your program links with when you do a debug build rather than a release build. The debug version is not included in the directx runtime installer, only in the SDK.
The license does not allow you to distribute it either.
You should build and distribute release versions of the code, or else require users to install the SDK which probably wouldn't be so popular!

How can I use Farseer with a MonoTouch/ExEn application?

I'm trying to build a game for iOS with XNA and Farseer Physics 3.3, using ExEn and MonoTouch. In theory this should work fine, but I'm having trouble getting Farseer to work on the iPhone.
I compiled Farseer for MonoTouch/ExEn, and it works great in the iPhone Simulator. But as soon as I switch to the actual iPhone, my project no longer compiles. The problem appears to be happening with the MonoDevelop linker. The compiler bombs out with the message "mtouch exited with code 1", and I get the following linker error output: http://pastebin.com/y62ykJP2. If I disable linking in the project options, the application compiles and deploys to the iPhone, but then crashes.
If I comment out all of the code that instantiates objects defined by Farseer, I don't get any linker errors, and the program deploys and runs just fine. So the problem is clearly with my build of Farseer for MonoTouch.
Unfortunately, I have no idea where to go from here. Where should I start looking with a linker error like this? Or, even better: Has anyone successfully compiled Farseer 3.3 and used it with MonoTouch and ExEn?
You're trying to use an assembly compiled for .NET 4.0 in MonoTouch. This will not work (the linker exception you get is because the assembly references a method that does not exist in MonoTouch).
The solution is to compile all assemblies you reference using MonoTouch. Look around to see if anybody already has created a MonoTouch project for Farseer, otherwise you'll have to create one yourself.

Embedding mono - "Fatal error in GC": "Too many root sets"

I'm embedding mono in C++ application, and I'm linking it via dll library, which is then loaded into application via LoadLibrary.
When the application starts and the dll runtime linking happens, the mono runtime seems to fail to initialize itself with "Too many root sets" message. I'm unsure when and how the runtime itself is initialized (I thought it happens on mono_jit_init, but the error pops up before any call to any of the mono functions. It occurs exactly at LoadLibrary should I try load it manually instead of relying on mono.lib import library).
I succesfuly embedded it in standalone application, so I assume it is something specific to the way my dll is loaded by the application, but I don't know what exactly.
Any clues?
This may be a limitation of the way the Boehm GC works in windows: it hooks to the operating system at LoadLibrary time to get notifications of the created threads and loaded libraries (this is why you get the issue at LoadLibrary() time and not on mono_jit_init()).
Or it may be that you have really many threads and libraries loaded by the time the GC is initialized. If you link the app to mono directly, does the problem go away? If yes, that should be your current workaround.
In the future (or if building mono from git) you may be able to use the SGen GC which shouldn't suffer from this problem.

Cocos2d Targeting iPhone/iPad/Mac

I recently did some research on making a cocos2d app for iPhone/iPad AND Mac. I have done the iPhone/iPad route but have never done it with a Mac target. It appears that some people have added it as a target but mentioned that it is finicky and others have suggested making a separate Cocos2d Mac project that uses the same files. Any wisdom to impart here?
I believe it is absolutely crucial to have both iOS and Mac targets in the same project. Otherwise you'll spend too much time keeping one platform in synch with the other, until eventually you either manage to create a good (but still time-consuming) workflow - or end up neglecting one of the two platforms.
Ideally the code base should make as little use as possible of compiler macros. You'll want to compile both iOS and Mac code even if it's not being used for one platform. So having some classes or methods that are #ifdef'ed to Mac, others to iOS, will more often than not lead to compile errors when you switch targets. That means wrapper classes, so that you can write the same code regardless of the platform, are essential.
Right now, Cocos2D doesn't offer you to create iOS & Mac targets in the same Xcode project. The way to get there isn't immediately obvious either, because each target requires its own build settings for: Base SDK, SDK Root, Deployment Target, Architectures and possibly Compiler version. It gets worse if you also want to use 3rd party libraries (Box2D, Chipmunk, etc) because in some cases you'll be forced to create iOS and Mac specific targets for those libraries as well - if only to ensure that the library is built with the same compiler as the project's target, otherwise you can run into the strangest build or runtime issues.
I've had issues getting these platform specific targets to work within a single Xcode project without Xcode complaining or otherwise misbehaving. I haven't tried it with Xcode 4.1 and 4.2. By that time I had created .xcconfig files to host the build settings. The .xcconfig files may or may not be necessary with the more recent Xcode versions but they definitely make managing multiple platform-specific targets easier.
Long story short, the best and easiest way to do cross-platform development with cocos2d-iphone is by using Kobold2D.
Most of the 15 template projects have an iOS and Mac target in each project, you just need to select the corresponding scheme, then hit build & run. The most commonly needed platform-specific code (processing user input) is wrapped in a platform-agnostic, simple to use wrapper class KKInput.
Disclaimer: I'm the developer of Kobold2D. There's a slim chance that I may be biased. You should try Kobold2D anyway. :)