Deployment in Windows (DLL)
Posted: 2015-06-10T04:29:45-07:00
Hi to all!
I have developed a simple console program that takes a coloured PDF and makes it a black and white PDF. It works OK in my development machine (Windows XP 32 bits, Visual Studio 2010) but it always fails in the function MagickReadImage in other machines (Windows 7 and 8.1 without ImageMagick installed).
This is the program:
The compiling options:
The linking options:
These are the DLLs I include with the magickexample.exe:
What am I doing wrong?
Thanks in advance!
I have developed a simple console program that takes a coloured PDF and makes it a black and white PDF. It works OK in my development machine (Windows XP 32 bits, Visual Studio 2010) but it always fails in the function MagickReadImage in other machines (Windows 7 and 8.1 without ImageMagick installed).
This is the program:
Code: Select all
// magickexample.cpp
#include "stdafx.h"
#include "wand/MagickWand.h"
#include <stdio.h>
int main(int argc, const char* argv[]) {
if (argc != 3) {
printf("\nUse: %s color_file.pdf bn_file.pdf\n\n", argv[0]);
return -1;
}
const char* ifile = argv[1];
const char* ofile = argv[2];
int threshold = 80;
MagickWandGenesis();
MagickWand* m_wand = NewMagickWand();
MagickBooleanType status = MagickReadImage(m_wand, ifile);
if (status == MagickFalse)
printf("!MagickReadImage (%d)\n", __LINE__);
else {
int npages = MagickGetNumberImages(m_wand);
printf("npages = %d\n", npages);
//MagickSetResolution(m_wand, 209.10, 98);
MagickSetImageFormat(m_wand, "FAX");
MagickResetIterator(m_wand);
while (MagickNextImage(m_wand) != MagickFalse)
MagickThresholdImage(m_wand, (double)threshold*(QuantumRange/100));
status = MagickWriteImages(m_wand, ofile, MagickTrue);
if (status == MagickFalse)
printf("!MagickWriteImages (%d)\n", __LINE__);
}
DestroyMagickWand(m_wand);
MagickWandTerminus();
return 0;
}
Code: Select all
/I"C:\ImageMagick-6.9.0-Q16-dll\include" /Zi /nologo /W3 /WX- /O2 /Oi /Oy- /GL /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /Gm- /EHsc /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Yu"StdAfx.h" /Fp"Release\magickexample.pch" /Fa"Release\" /Fo"Release\" /Fd"Release\vc100.pdb" /Gd /analyze- /errorReport:queue
Code: Select all
/OUT:"C:\Documents and Settings\daniel\Mis documentos\Visual Studio 2010\Projects\magickexample\Release\magickexample.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\ImageMagick-6.9.0-Q16-dll\lib" "CORE_RL_wand_.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /MANIFEST /ManifestFile:"Release\magickexample.exe.intermediate.manifest" /ALLOWISOLATION /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"C:\Documents and Settings\daniel\Mis documentos\Visual Studio 2010\Projects\magickexample\Release\magickexample.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /PGD:"C:\Documents and Settings\daniel\Mis documentos\Visual Studio 2010\Projects\magickexample\Release\magickexample.pgd" /LTCG /TLBID:1 /DYNAMICBASE /NXCOMPAT /MACHINE:X86 /ERRORREPORT:QUEUE
- CORE_RL_bzlib_.dll
- CORE_RL_glib_.dll
- CORE_RL_lcms_.dll
- CORE_RL_lqr_.dll
- CORE_RL_magick_.dll
- CORE_RL_ttf_.dll
- CORE_RL_wand_.dll
- CORE_RL_zlib_.dll
- MSVCP100.dll
- MSVCR100.dll
- VCOMP100.dll
Code: Select all
!MagickReadImage (22)
Thanks in advance!