Referencing libraries from other solution - dot42

I have custom library that is located in a separate solution. When I reference that library in a new solution everything works fine, except when I try to build it. I get the error:
Error 1401 Failed to load assembly Utilities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Error 1402 Failed to resolve assembly: 'Utilities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
Anyone had similar problems?
Thank you

Solved
Since Dot42 does not have Tuple class I created my own Tuple in my library and used the same namespace (System). Looks like there's a problem System.* namespaces are used. I wanted to use the same namespace to avoid defines in using clauses.
Once I changed namespace it started working :)

Related

The type of namespace 'Logging' does not exist in the namespace 'Sitecore'

Added Sitecore.Logging dll (from nuget) in the project but I still get the error.
It was working fine until I added a log4net dll (as part of some other nuget dependency). After this there was an ambiguous reference error. Then when I tried to specify Sitecore.Logging.LogManager/ Sitecore.Logging.ILog I get the error .
The type of namespace 'Logging' does not exist in the namespace 'Sitecore'
The Sitecore.Logging.dll does not contain classes in the Sitecore.Logging namespace, though you may be forgiven for expecting that to be the case - it is certainly the convention.
Opening it up with a decompiler reveals a forked version of log4net hiding in there.
You are probably looking for the log factory in Sitecore.Diagnostics.Log in the Sitecore.Kernel.dll
Right click the newly added log4net dll -> properties -> Aliases-> give a different name like 'log'. This will resolve the ambiguity in the code.

Train net using caffe DLL in C++

The most recent Windows Branch of caffe (https://github.com/BVLC/caffe/tree/windows) provides the option to compile caffe as a DLL.
I found it hard to find example code how to use the DLL in another C++ project as most people use the python interface, which is not a preferred option in my case. Looking at the implementation of the train() method in caffe.cpp, I tried the following to train a net:
caffe::SolverParameter solver_param;
caffe::ReadSolverParamsFromTextFileOrDie("C:\\path\\to\\solver.prototxt", &solver_param);
Caffe::set_mode(Caffe::GPU);
shared_ptr<caffe::Solver<float>>
solver(caffe::SolverRegistry<float>::CreateSolver(solver_param));
solver->Solve();
Unfortunately, the first line throws a linker error, although I added caffe.lib and specified the path to caffe.lib and caffe.dll in my project properties in VS. Accessing other caffe functions (such as set_mode) works fine.
Apart from the linker error (suggestions to solve it are appreciated!), does the code look plausible to you? Did anyone manage to use caffe functionalities in C++ and is willing to share a code snippet?
You need to link to caffeproto.lib and to libprotobuf.lib to solve dependencies error for this piece of code.
Just diving into caffe so I can't really judge your code. I am looking at this:https://medium.com/#shiyan/caffe-c-helloworld-example-with-memorydata-input-20c692a82a22 and so far found it helpful.

"No functions found" warning importing external dll file

Good afternoon,
I'm trying to work with some C++ dll files with Matlab, and I'm trying to implement a simple test case to understand the procedure. The dll file I'm using is copied verbatim from here:
https://msdn.microsoft.com/en-us/library/ms235636.aspx
I only implement up to step 5, since my hope is to call the dll file through Matlab. After completing step 5, I copy MathLibrary.h and MathLibrary.dll to the directory I'm using for my Matlab code, and then run
[notfound,warnings]=loadlibrary('MathLibrary.dll','MathLibrary.h');
Upon running this I get the warning
>Warning: No functions found in library.
>
>In C:\Program Files\MATLAB\R2014b\toolbox\matlab\general\loadlibrary.p>loadlibrary at 431
The cell array notfound is empty and warnings is an array with warnings = MathLibrary.h
If I try using one of the functions from the dll, I execute the following code:
calllib('MathLibrary','Add',5,3)
which throws the following error
>Error using calllib
>
>Method was not found.
I've tried Googling solutions to similar problems, but have not found solutions where I've looked (at least ones I've understood). My C++ is weak, which may be hindering my understanding of the problem and solution. I'm hoping to incorporate dll files from a much larger project soon, so understanding this would be a great help. Thanks so much!

Build error referring to yvals.h in a cantata++ test project

I am testing c++ source codes using the tool cantata++. I created a project, built it and encounter the following error message.
error I9282: the global scope has no "_invalid_parameter" C:\LegacyApp\VisualStudio2005\VC\include\yvals.h 167
I find this error wierd, because yvals.h is not really a file in my source codes. What does this error message imply?
You'll find that yvals.h is probably included by one of the many system header files the Microsoft compiler includes, and you are only seeing it in the error message because the Cantata++ instrumenter is finding a problem with it. My guess would be that there is some problem with the settings in either Cantata++, your Visual Studio project or a mismatch between the two meaning they are not using the same settings.
In order to help diagnose the problem it would help to know a few things about the setup you have, and the code you are building when you get the error.
As Joachim Wuttke said, I would suggest you contact the Cantata Technical Support team directly if you are still having problems with this issue. They will be able to provide you with further information to help solve the problem.

using NtCreateSection from ntdll.lib

I was just trying to use NtCreateSection in my code and the information at this link states the requirement as ntdll.lib. As Im using VS2010, I went to Projects > Properties > Linker > Input > Additional Dependencies and added ntdll.lib.
However, on building the solution I get an error error C3861: 'NtCreateSection': identifier not found. I'm curious about why this happens.
A workaround I'm considering is getting a handle to ntdll using LoadLibrary and getting a handle to NtCreateSection using GetProcAddress; however Im just curious about why the earlier method did not work out.
Thanks!
Perhaps of interest is the actual documentation of the function: http://msdn.microsoft.com/en-us/library/windows/hardware/ff556473(v=vs.85).aspx
This points you to a ZwCreateSection function, which notes that NtCreateSection is the name to be used for user-mode calls to this function: http://msdn.microsoft.com/en-us/library/windows/hardware/ff566428(vr85).aspx
In the standard header/library reference in the actual documentation, it says Wdm.h is the header to be included. I would recommend checking that file for the function(s), and proceeding from there. The docs for both functions, and the guide pages linked from them, also seem to have some info on things.