пятница, 1 ноября 2013 г.

Adding an additional path for finding dll in Visual Studio

Imagine that your application requires any dll. If the dll path is not in the $(PATH) or system32 or the application folder then you get the error right after starting:
To point out where to search the dll go to Project Properties->Debugging->Enviroment and change this values as PATH=MySpecialDirectory/To/Search/Dll/$(PATH)

четверг, 17 октября 2013 г.

Getting current user's desktop path on Mac OS

The simplest solution is
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDesktopDirectory, NSUserDomainMask, YES );
NSString* theDesktopPath = [paths objectAtIndex:0];

But in the case of running the application in sudo mode it gives us the root's desktop path. To fix it use
 NSString* home = [[[NSProcessInfo processInfo] environment] objectForKey:@"HOME"];
 NSString *pathToDesktop = [NSString stringWithFormat:@"%@/Desktop", home];

суббота, 24 августа 2013 г.

How to build 32-bit curl and openssl on 64-bit Mac OS X

First let's donwload and build openssl:
OPENSSL_VERSION="1.0.1e"
mkdir -p ~/packages/tmp_src
cd ~/packages/tmp_src
curl http://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz > openssl-$OPENSSL_VERSION.tar.gz
tar -xvzf openssl-$OPENSSL_VERSION.tar.gz
mv openssl-$OPENSSL_VERSION openssl_i386

cd openssl_i386
./Configure darwin-i386-cc
make -j 8
make install
cd ../
To make sure that we built 32-bit versions:
lipo -info /path/to/libssl.a
lipo -info /path/to/libcrypto.a
It should tell us that architecture is i386 Then do the same for curl
CURL_VERSION="7.29.0"
curl http://curl.haxx.se/download/curl-$CURL_VERSION.tar.gz > curl-$CURL_VERSION.tar.gz
tar xzvf curl-$CURL_VERSION.tar.gz
mv curl-$CURL_VERSION curl_i386
cd curl_i386
./configure --with-ssl=/usr/local/ssl --prefix=/Users/USERNAME/packages/tmp_src/curl_i386 --disable-shared --host=i386 --disable-ldap --without-zlib
make -j 8
#make install

четверг, 4 апреля 2013 г.

Using alternative tokens in Visual Studio

There's an interesting thing in C++ called alternative tokens
For using tokens in Visual Studio you should:
  • - For the tokens from 1st column compile with /Za flag (Configuration properties->C/C++->Language->Disable language Extensions = Yes)
  • - For the tokens from 2nd and 3rd columns include <iso646.h>

суббота, 23 марта 2013 г.

Libcurl and linker errors

If you were to install libcurl on Windows you could come across a bulk of linker errors such as
Error 1176 error C2065: '_SH_DENYNO' : undeclared identifier c:\program files (x86)\microsoft visual studio 10.0\vc\include\xiosbase
How to fix it? Go to curl sources, rename share.h to share_curl.h for instance and replace all occurences of
#include "share.h"
with
#include "share_curl.h
Then recompile libcurl.