What does Lambda Expression Compile() method do?

What interests me is the Compile() method. Does it somehow produce real MSIL? Yes. The Compile method runs a visitor over the lambda body block and generates IL dynamically for each subexpression. If you’re interested in learning how to spit IL yourself, see this “Hello World” example of how to use Lightweight Codegen. (I note … Read more

Why does division by 3 require a rightshift (and other oddities) on x86?

Can’t we multiply rax with edi directly? We can’t imul rax, rdi because the calling convention allows the caller to leave garbage in the high bits of RDI; only the EDI part contains the value. This is a non-issue when inlining; writing a 32-bit register does implicitly zero-extend to the full 64-bit register, so the … Read more

How to compile openmp using g++

OpenMP is a set of code transforming pragmas, i.e. they are only applied at compile time. You cannot apply code transformation to an already compiled object code (ok, you can, but it is far more involving process and outside the scope of what most compilers do these days). You need -fopenmp during the link phase … Read more

How to make Visual Studio use the native amd64 toolchain

There is another method of forcing use of the 64-bit linker on a per-project basis for Visual Studio 2013. Edit your .vcxproj file and insert the following after the <Import…Microsoft.Cpp.Defaults line: <Import Project=”$(VCTargetsPath)\Microsoft.Cpp.Default.props” /> <PropertyGroup> <PreferredToolArchitecture>x64</PreferredToolArchitecture> </PropertyGroup>

How to compile dynamic library for a JNI application on linux?

Native library can be loaded by loadLibrary with a valid name. By example, libXXXX.so for linux family, your hellolib.so should rename to libhello.so. By the way, I develop java with jni, I will separate the implementation and native interface (.c or .cpp). static { System.loadLibrary(“hello”); // will load libhello.so } The implementation header(HelloImpl.h): #ifndef _HELLO_IMPL_H … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)