LibRaw on Visual Studio with Target Machine x64

I can understand it is a naive question but I have searched enough and was wondering if it is at all possible to run libraw on a visual studio project with platform and target machine set to x64. Everything works fine when platform and target machine are x64, but it complains of unresolved externals whenever they 're set to x64. I wanted to integrate it into a large project which has been aimed for 64 bits so far anyway. Thank you in advance.

Forums: 

Sorry: I meant "Everything

Sorry: I meant "Everything works fine when platform and target machine are x86"

We use LibRaw in 64-bit

We use LibRaw in 64-bit windows projects (Visual Studio 2010 and 2013) without any problem.

Could you please describe the problem in more details?

-- Alex Tutubalin @LibRaw LLC

64 bit build

Thank you for your response. So when machine module type and target is set to x86, everything works fine. When I convert both to x64 From Release Target in Configuration Manager and Linker -> Advanced -> Target Machine, I get the following output:

1>------ Rebuild All started: Project: LibrawReader, Configuration: Release x64 ------
1> readFile.cpp
1>c:\users\imnet\downloads\compressed\libraw-0.17.0_2\libraw-0.17.0\libraw\libraw_datastream.h(98): warning C4251: 'LibRaw_file_datastream::filename' : class 'std::basic_string,std::allocator>' needs to have dll-interface to be used by clients of class 'LibRaw_file_datastream'
1>c:\users\imnet\downloads\compressed\libraw-0.17.0_2\libraw-0.17.0\libraw\libraw_datastream.h(101): warning C4251: 'LibRaw_file_datastream::wfilename' : class 'std::basic_string,std::allocator>' needs to have dll-interface to be used by clients of class 'LibRaw_file_datastream'
1>c:\users\imnet\downloads\compressed\libraw-0.17.0_2\libraw-0.17.0\libraw\libraw_datastream.h(200): warning C4251: 'LibRaw_bigfile_datastream::filename' : class 'std::basic_string,std::allocator>' needs to have dll-interface to be used by clients of class 'LibRaw_bigfile_datastream'
1>c:\users\imnet\downloads\compressed\libraw-0.17.0_2\libraw-0.17.0\libraw\libraw_datastream.h(203): warning C4251: 'LibRaw_bigfile_datastream::wfilename' : class 'std::basic_string,std::allocator>' needs to have dll-interface to be used by clients of class 'LibRaw_bigfile_datastream'
1>readFile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl LibRaw::~LibRaw(void)" (__imp_??1LibRaw@@UEAA@XZ)
1>readFile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __cdecl LibRaw::recycle(void)" (__imp_?recycle@LibRaw@@QEAAXXZ)
1>readFile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __cdecl LibRaw::raw2image(void)" (__imp_?raw2image@LibRaw@@QEAAHXZ)
1>readFile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __cdecl LibRaw::unpack(void)" (__imp_?unpack@LibRaw@@QEAAHXZ)
1>readFile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: int __cdecl LibRaw::open_file(char const *,__int64)" (__imp_?open_file@LibRaw@@QEAAHPEBD_J@Z)
1>readFile.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __cdecl LibRaw::LibRaw(unsigned int)" (__imp_??0LibRaw@@QEAA@I@Z)
1>c:\users\imnet\documents\visual studio 2013\Projects\LibrawReader\x64\Release\LibrawReader.exe : fatal error LNK1120: 6 unresolved externals
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

What do you think is the problem?

unresolved symbols mean you

unresolved symbols mean you cannot link with correct .dll (or lib).

Are you sure you've rebuilt libraw.dll with 64 bit?

-- Alex Tutubalin @LibRaw LLC

Libraw build

I used vcvars32.bat initially to build the correct libraw.dll but then figured i should use vcvarsall.bat for 64 bit build, though there was no difference. If that's not the correct way, how do you rebuild it with 64bit? Thanks a lot again

vcvars32 surely will set x32

vcvars32 surely will set x32 environment.

To rebuild 64-bit libraw.dll I succesfully use this:

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
nmake -f Makefiile.msvc

-- Alex Tutubalin @LibRaw LLC

It Worked.

Thank you Alex. It Worked. I am very very grateful. All the best.

And vcvarsall without x64

And vcvarsall without x64 will create x86 environment, just first lines from this .bat:

@echo off
if "%1" == "" goto x86

-- Alex Tutubalin @LibRaw LLC

64 bit version crashes

I appreciate your help in creating a 64 bit version of LibRaw for Windows. I can interface with this library version from a 64 bit Java VM using BridJ, but if I try to call the init() method of LibRaw when compiled as a 64 bit dll it crashes. I get EXCEPTION_ILLEGAL_INSTRUCTION (0xc000001d) at pc=0x00007ffdd79069ac, pid=6876, tid=6592. Any clue on what I can do?

LibRaw (C++ API) do not have

LibRaw (C++ API) do not have init() method. So, I do not know what you call.

-- Alex Tutubalin @LibRaw LLC

Creating dymamic library on Linux

I've managed creating dynamically loaded libraries of LibRaw for Mac, Win32 and Win64 now. The only thing that remains are dynamic libraries for Linux32 and Linux64. I would very much appreciate your help with this. When running the make file I end up with .a, .la and .lib files only.

yes, you need to change

yes, you need to change makefile, or use ./configure stuff.

-- Alex Tutubalin @LibRaw LLC

Sorry, I know nothing about

Sorry, I know nothing about Linux shared libraries creation.

./configure should work, meanwhile.

-- Alex Tutubalin @LibRaw LLC