Compile ansi c vendor library with objective-c - objective-c

I'm using ObjC to build my app's ui, and my app depends on an ansi c library, I have the ansi c library's source code. How can I use Xcode to compile this app (For development, I can install the library into my Mac). But I want to ship my app to users without any external dependency, just like any other apps, user don't need to install the dependencies, so how can I accomplish this?

If you have static library then add the same to your Xcode project and compile application. During linking phase library is linked with Application binary and hence no separate installation required for the library.
In case library is dynamic library then check the installation path. If the library installation directory is outside application bundle then you need to create installer to install library to installation directory. On the other hand if installation directory is relative to #excutable path then you can keep the library inside your application bundle and no installation required. You can use copy file phase to copy library into your application bundle.Refer Apple documentation

Related

How we Integrated Libgit2 library in Visual Studion 2010 Windows Application

I downloaded two DLLs (libgit2sharp.dll and git2.dll) from this site.
After that I successfully added Libgit2sharp.dll by add reference in my .NET Windows application. Now when I add git2.dll by add reference in my .NET Windows Application, it gives an error:
a reference to 'C:\User\nitesh\git2.dll' could not be added please make sure that the file is accessible and that it is a valid assembly or COM component
Can anyone please help me understand the problem?
I downloaded two DLLs (libgit2sharp.dll and git2.dll) from this site.
First off, this is not a distribution channel that the libgit2/libgit2sharp team has anything to do with.
Install as a NuGet package:
Official releases are available as a NuGet package if you prefer to download pre-built sources. See this post which explains how to install the NuGet Package Manager in Visual Studio.
This is the easiest way to make LibGit2Sharp available to your project.
Build from the source code:
You can download the source code and build the C# code into LibGit2Sharp.dll from https://github.com/libgit2/libgit2sharp, which includes the pre-built version of git2.dll which works for the particular version of the C# code.
Easiest way to build the assembly is by launching the build.libgit2sharp.cmd. This will create a Build folder into which you'll find the LibGit2Sharp.dll and a NativeBinaries folder with the native binaries.
Now when I add git2.dll by add reference in my .NET Windows Application, it gives an error
As for the error message, it sounds like you're trying to add the git2.dll to the project as though it were a CLR/.NET assembly. It is however built from C and isn't something VS is going to do anything useful with. You do not need to add it to your project.
It does need to be available for libgit2sharp to load. The following graph depicts the folder hierarchy that libgit2sharp expects
NativeBinaries+
|___amd64+
|___git2-{shortsha}.dll
|___git2-{shortsha}.pdb
|_____x86+
|___git2-{shortsha}.dll
|___git2-{shortsha}.pdb
Note: This folder structure will be dynamically created in your project output folder if you installed LibGit2Sharp as a NuGet package. However, if you built the project from the source code, you'll have to copy this folder structure as part of your project build process yourself.

Nuget, portable library and WinRT appx: Payload contains two or more files with the same destination path

Create new Windows 8 application App1
Add ClassLibrary1 Windows 8 class library project to solution
Add PortableClassLibrary1 portable class library targeting Windows 8 and Windows Phone 7.5 to a solution
Reference HttpClient nuget package in ClassLibrary1
Reference HttpClient nuget package in PortableClassLibrary1
Reference both ClassLibrary1 and PortableClassLibrary1
Compile solution
You get an error at .appx package stage
Payload contains two or more files with the same destination path 'System.Net.Http.Primitives.dll'.
Source files:
\Projects\App1\PortableClassLibrary1\bin\Debug\System.Net.Http.Primitives.dll
\Projects\App1\packages\Microsoft.Net.Http.2.2.13\lib\win8\System.Net.Http.Primitives.dll
Please note the same error is reproduced if you reference any nuget package featuring both win8 and portable blends of assemblies.
What is expected:
Most specific version of a library (win8 one) is packaged into .appx and portable version is ignored
Any ideas on how to cheat appx packager and build this kind of Windows 8 projects?
It looks like the solution described here works: http://cyanbyfuchsia.wordpress.com/2013/05/03/payload-contains-two-or-more-files-with-the-same-destination-path/
Basically, you must set "Copy local" to false in the WinRT project that is referenced from the main app.
In addition to this, you should be getting warnings similar to:
All projects referencing ClassLibrary1.csproj must install nuget
package Microsoft.Bcl.Build. For more information, see
http://go.microsoft.com/fwlink/?LinkID=317569.
This is indicating a problem. Basically, the short of it, you should be installing HttpClient.Compression into all projects. MSBuild/AppX packaging doesn't know which binary to deploy between the portable library and store library project (they have different APIs & versions). Installing the package into the application, tells it.
I had such issue too. It was because I shared one of my solution between projects. I had to rename the solution, because the name was all the same like one of the projects. After renaming I had this problem.
I fixed it by: right click on solution I renamed and used both projects, then properties, then use same name in the assembly name like solution name.

C++ Builder XE not linking all runtime DLLs

When I compile my project with the option to exclude runtime packages (to do a static library linking) everything goes fine.
But when I run my application on a C++ Builder "virgin" (no packages installed) it won't start and shows the following error:
The program can't start because CC32110MT.DLL is missing from your computer...
The CC32110MT.DLL is signed as a Embarcadero RAD Studio C++ Multi-thread RTL (WIN/VCL MT)
Any ideas of how to fix this other than copy the DLL to the target system?
In C++Builder, you have to disable both the Dynamic RTL and Runtime Packages in order to produce a fully statically-linked executable (in Delphi, there is no Dynamic RTL). You have only disabled the latter, but not the former yet.

Build Cocoa application Bundle with private dylib/framework

I use xcode 4 to build a cocoa application with a private dylib/framework.
In my development Mac, I put the dylib in the /usr/local/lib directory, and drag it into the project.
The app is compiled and runs perfect on my computer.
To distribute this app to the other Mac, I create a copy Files building phase, and say "copy that dylib to Frameworks directory".
The application is built successfully, and I indeed see the dylib is copied to the Frameworks directory in the app bundle.
The problem is when I run this app in another regular Mac, which does not have this dylib installed. I get an error saying:
dyld: Library not loaded: /usr/local/lib/mylib.dylib
The issue comes from the fact that you copy the framework into the app bundle, so it is available at a location like:
<you_app_path>/Contents/Frameworks
but you try to load it from /usr/local/lib where it is not available on you deployment machine. From Apple Framework Programming Guide:
To embed a framework in an application, there are several steps you must take:
You must configure the build phases of your application target to put the framework in the correct location.
You must configure the framework target’s installation directory, which tells the framework where it will live.
You must configure the application target so that it references the framework in its installation directory.
Now, you say that the build phase is ok; I assume also that you sent the application target build setting correctly. What is left is configuring the framework target’s installation directory.
If you did not build the framework yourself, you should be able to fix this by changing the framework install path so that it is defined relative to the loader (your app), to something like: #loader_path/../Frameworks/ (or #executable_path/../Frameworks). You can do that by means of install_name_tool.
If you are compiling on your own the private framework, you can define its install location in Xcode build settings.

Which CUDA runtime DLL is used?

I have an application which use CUDA. I am using runtime API and CUDA toolkit 3.2. Application has a dependency on cudart32_32_7.dll. However, there is also cudart32_32_12.dll. The issue is, I do not know how to determine which dll is linked from cudart.lib during the application build. I need to identify dependency dynamically somehow, because I need to include all dependencies into the deployment package. I would like to avoid hard coding dependency path ...
Just put the .dll or .exe of your project into this software: Dependency walker. It will show on what other .dlls yours project depends on. There you'll find either cudart32_32_7.dll or cudart32_32_12.dll.
Alternatively, if you're making a binary project. Just compile it and run the binary (.exe) on a different machine that doesn't have CUDA installed. An error message will come asking for either cudart32_32_7.dll or cudart32_32_12.dll.