I have two projects.
MFC project
Win32 Project.
My main project is win32 project. But I have 2 methods which are very important in MFC project. I tried to add those two methods in my win32 project. I am unable to do it. So please help me.
Thanku.
Create a DLL and add those methods in the DLL and access it in both MFC and WIn32 projects
Related
I have a solution with:
A project that handles business logic through crud functions. At some point the project uses System.Runtime.Caching
Other webforms, MVC and RESTservice projects. (irrelevant to the topic)
A newly created Xamarins.Forms project targeting .netstandard2.0
My problem is that when I reference the business logic project in the Xamarin.forms project then the Xamarin.Android project errors that it can not resolve the reference System.Runtime.Caching referenced by the business logic project.
It suggests that I add a NuGet package or assembly reference for System.Runtime.Caching, or remove the reference to the business logic project.
I have tried installing the package for both the Xamarin.Forms project and the related Xamarin.Android project. But it does nothing.
I am in a bit of halt here since I am unable to figure what the problem is and better yet how to sovle it.
System.Runtime.Caching doesnt seem to be part of .Net standard hence you can not add it .Check the nuget log when you try to add it.
You might be calling web project/API project code directly from xamarin forms, dont do that. You need to isolate the two.
I have a solution which has two projects. One is a static link library project, and another is a console project for demo. Now I want to create a MFC project to replace the console project, what should I do to configure the MFC project.
the MFC project need to use some classes in the .lib project.
I have set MFC project as start project and depend on the .lib project.
My platform is win7 + vs2015.
Actually, the solution is EasyPR, you can get it here EasyPR.
Thanks for any help.
Setting the dependency to the static library is one step.
To compile the code you may need headers for the compiler. So the MFC projects may need settings for the compiler to define additional include paths.
You still need to configure the linker to use and find the library. To reference the library you may use a pragma comment lib. In the linker settings you may add an additional path for the libraries.
Or you may simply drag the lib into the solution explorer. The build mechanism will know how to treat a lib and will include it into the build process. The later will only work if you have 1 lib for release and debug.
If you have different libs for release and debug a advise you to use different names. You may adjust the project settings of the MFC program for debug and release differently.
I'm developing a xamarin forms class library (Custom Component) that targets (Windows, Androi and IOS) platforms "this library should be added to an existing Xamarin forms Portable project as DLL reference" and want to add a UI control and use it's native functions from inside the library. Custom renderers can't be added in PCLs so Can anyone help on how to access the control's native functionality?
You can start from scratch on your by following this piece of documentation by Xamarin on how to build NuGet packages. Then just make sure you build them without too much references and test them in your sample projects.
But to make your life a lot easier have a look at this Visual Studio extension by James Montemagno. It installs some project templates for you so naming is consistent and you have the basics already setup to start building your reusable code.
I created a Xamarin project MyApp within VS2015. This ends up creating a bunch of projects including MyApp.Droid for Android. I can build and deploy this project just fine on my Android device.
Next, I created a shared C++ Dynamic Shared Library (Android) project MyShared. When I try to add this project as a reference in MyApp.Droid, it reports an error that only .dll or .exe file types can be added as a reference and not .so types.
Wondering if there is a different way to add a native library project as a dependency. Regards.
Xamarin.Android supports the use of native libraries via the standard PInvoke mechanism.
You will need to define the DllImport C# attributes/signatures, there are various tools such as SWIG, PInvoker Visual Studio Addin, Mono's CppSharp, etc.. that can assist in this step.
(Personally I use Mono's CppSharp, but it might be overkill depending upon the number of classes/methods/functions there are within your C++ library.)
Mono Interop with Native Libraries
Xamarin.Android : Using Native Libraries
To interop with native libraries in your Xamarin.Android project, all you need to do is create a DllImport function declaration for the existing code to invoke, and the runtime will handle the rest. Set the EntryPoint to specify the exact function to be called in the native code.
Build and Debug C++ Libraries in Xamarin.Android Apps with Visual Studio 2015
Under Visual Studio 2015, I have integrated Android C++ code into Xamarin and it works as expected. Now, I am trying to do the same for iOS and am running into some basic issues.
I am assuming the integration mechanism is the same for iOS as that of Android in the sense that a shared library (probably .so) is created that one can load using DllImport in C# code.
When I try to add a new C++ project for iOS to my solution, the only option that seems to make sense is Visual C++-->Cross Platform-->iOS-->Shared Library. I added this project type as MyTestShared. This actually ends up creating three projects - MyTestShared.Shared, MyTestShared.iOS, and MyTestShared.Android. Project MyTestShared.iOS already has an external method defined as char* iOSInfo(). However, when I try to add project MyTestShared.iOS as a reference to my MyMainApp.iOS project, I see an error "A reference to MyTestShared.iOS could not be added. An assembly must have a dll or exe extension."
Questions:
For Android C++, it generates exactly one project. Why does it create three projects for iOS C++?
How do I add a reference to MyTestShared.iOS? What is it that I am missing?
I see there is an option to create a static C++ library for iOS. Can I reference it somehow in my C# code?
Regards.