msys path conversion (or cygpath for msys?)

Update (Aug-2016): This question is no longer relevant, as msys2 now comes with cygpath in its installation. … I’ll summarize my research here. The cygpath equivalent in MSYS is to use this command: { cd /c/some/path && pwd -W; } | sed ‘s”https://stackoverflow.com/”\\|g’ The problem with this approach is that it requires existing path, e.g. … Read more

What is the most portable/cross-platform way to represent a newline in go/golang?

I got curious about this so decided to see what exactly is done by fmt.Println. http://golang.org/src/pkg/fmt/print.go If you scroll to the very bottom, you’ll see an if addnewline where \n is always used. I can’t hardly speak for if this is the most “cross-platform” way of doing it, and go was originally tied to linux … Read more

How to design a C / C++ library to be usable in many client languages? [closed]

Mostly correct. Straight procedural interface is the best. (which is not entirely the same as C btw(**), but close enough) I interface DLLs a lot(*), both open source and commercial, so here are some points that I remember from daily practice, note that these are more recommended areas to research, and not cardinal truths: Watch … Read more

Portability of binary serialization of double/float type in C++

Brian “Beej Jorgensen” Hall gives in his Guide to Network Programming some code to pack float (resp. double) to uint32_t (resp. uint64_t) to be able to safely transmit it over the network between two machine that may not both agree to their representation. It has some limitation, mainly it does not support NaN and infinity. … Read more

Can placement new for arrays be used in a portable way?

Personally I’d go with the option of not using placement new on the array and instead use placement new on each item in the array individually. For example: int main(int argc, char* argv[]) { const int NUMELEMENTS=20; char *pBuffer = new char[NUMELEMENTS*sizeof(A)]; A *pA = (A*)pBuffer; for(int i = 0; i < NUMELEMENTS; ++i) { … Read more

Is there any guidance on converting existing .NET class libraries to portable libraries?

We also converted existing libraries to portable libraries and it works fine. You have to modify the project file. Replace the following line: <Import Project=”…” /> with <Import Project=”$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets” /> Add following line inside a PropertyGroup tag <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> And remove following lines from the AssemblyInfo.cs file [assembly: ComVisible(false)] [assembly: Guid(“…”)] After that, Visual Studio should … Read more

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