how to compile dcmtk for wince(arm architecture)?

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

how to compile dcmtk for wince(arm architecture)?

#1 Post by jixiang »

hello,everyone,I have complied dcmtk successfully on win32 using vs2005,but our project is running on wince ,now,I need rebuild the dcmtk.I selcect the config manager "OMAP_3530(ARMV4I)" and compile it with vs 2005,there were a lot of error.

I found some problems but I didn't solve them:

(1)wince use unicode but the dcmtk use the char ;

(2)some functions about time such as time(),gmtime(),localtime() are not surportted by wince.

what can I do??
how to config the CMakeLists.txt for wince?
Last edited by jixiang on Tue, 2011-01-04, 11:02, edited 3 times in total.

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#2 Post by Michael Onken »

Hi,

ad 1: DCMTK does not support any character sets, it just reads each byte from the DICOM file as it is. So you should be able to use Unicode on top of DCMTK but you will have to convert to char if you give it to DCMTK. There should be functions for that on Win CE.

ad 2: We have no experience to build DCMTK for current Windows CE systems. But in general, you would have to detect this platform in the code and use #ifdefs in order use the time functions of Windows CE instead.

Best regards,
Michael

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

#3 Post by jixiang »

thank you, you said detect the system,how to config the cmakelist for wince.

/*cmakelist.txt*/

# declare project
PROJECT(dcmtk)

# check for Windows operating system
#IF(NOT WIN32)
#MESSAGE(FATAL_ERROR "Please use GNU autoconf for Unix systems.")
ENDIF(NOT WIN32)

how to modify it to detect wince or use what macro ?
thanks.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#4 Post by Jörg Riesmeier »

I'm not sure whether CMake already supports Windows CE (this is something you should probably check on the CMake website and/or mailing list).
However, you should definitely switch to the latest snapshot of DCMTK instead of using the "old" release 3.5.4.

With regard to Windows CE support for DCMTK: We have investigated this a couple of years ago but neither had the time nor the requirement to actively support it. A colleague of mine had checked the required changes at that time but did not finish this job (as far as I know). Regarding the ASCII/Unicode issue: There are conversion macros (e.g. USES_CONVERSION and A2T) that can be used for this purpose (as far as I know).

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

#5 Post by jixiang »

At Present, firstly,I try to compile the ofstd package because all of the other packages depend on it.

in ofstd package: oftime.cxx,ofdate.cxx,ofdatime.cxx,offname.cxx
the four functions have some funtions about processing time with CRT.I
use some functions on wince to take the place of them. there still are a lot of problems :
1. wince have not such include files :cerrno and io.h.(included in ofstdinc.h)
checking the source code , the ofstd.cxx need the errno macro in cerrno and access function in io.h.I use GetFileAttribute instead of access(line 400 in ofstd.cxx),but I have no idea to solve the errno macro reference.

2. I know we have to interconvert in char and unicode.the question is
that all of the files refered to char need to convert ,the job is huge.whether there are other good methods to process it.

the following is the code I modified in ofstd package.I don't know whether right or not .If someone interests in it,we can discuss it.

gmtime() replaced by GetSystemTime()
localtime() replaced by GetLocalTime()
time_t replaced by FILETIME
struct tm replaced by SYSTEMTIME

/*oftime.cxx*/ 300-308
OFBool OFTime::setCurrentTime()
{
/* get the current system time and call the "real" function */

//return setCurrentTime(time(NULL));
SYSTEMTIME systm;
return setCurrentTime(systm);

}

line 311-382
//OFBool OFTime::setCurrentTime(const time_t &tt)
OFBool OFTime::setCurrentTime(SYSTEMTIME& tt)
{
OFBool status = OFFalse;
#if defined(_REENTRANT) && !defined(_WIN32) && !defined(__CYGWIN__)
// use localtime_r instead of localtime
// struct tm ltBuf;
//struct tm *lt = &ltBuf;
// localtime_r(&tt, lt);
#else
//struct tm *lt = localtime(&tt);
GetLocalTime(&tt);
SYSTEMTIME *lt = &tt;
//GetLocalTime(&systm);
#endif
if (lt != NULL)
{
/* store retrieved time */
//Hour = lt->tm_hour;
//Minute = lt->tm_min;
//Second = lt->tm_sec;

Hour = lt->wHour;
Minute = lt->wMinute;
Second = lt->wSecond;
#if defined(_REENTRANT) && !defined(_WIN32) && !defined(__CYGWIN__)
// use gmtime_r instead of gmtime
//struct tm gtBuf;
//struct tm *gt = &gtBuf;
//gmtime_r(&tt, gt);
#else
// avoid overwriting of local time structure by calling gmtime()
// struct tm ltBuf = *lt;
//lt = &ltBuf;
// struct tm *gt = gmtime(&tt);

SYSTEMTIME ltbuf = *lt;
lt =& ltbuf;
GetSystemTime(&tt);
SYSTEMTIME* gt = &tt;
//GetSystemTime(gt);


#endif
if (gt != NULL)
{
/* retrieve and store the time zone */
TimeZone = (lt->wHour - gt->wHour) + OFstatic_cast(double, lt->wMinute - gt->wMinute) / 60;
/* correct for "day overflow" */
if (TimeZone < -12)
TimeZone += 24;
else if (TimeZone > 12)
TimeZone -= 24;
} else {
/* could not retrieve the time zone */
TimeZone = 0;
}
#ifdef HAVE_WINDOWS_H
/* Windows: no microseconds available, use milliseconds instead */
SYSTEMTIME timebuf;
GetSystemTime(&timebuf);
Second += OFstatic_cast(double, timebuf.wMilliseconds) / 1000;
#else /* Unix */
struct timeval tv;
if (gettimeofday(&tv, NULL) == 0)
Second += OFstatic_cast(double, tv.tv_usec) / 1000000;
#endif
/* report that current system time has been set */
status = OFTrue;
}
return status;
}



/*oftime.h*/ line 362
// OFBool setCurrentTime(const time_t &tt);
OFBool setCurrentTime(SYSTEMTIME &tt);

/*ofdate.cxx*/ line 206- 212
OFBool OFDate::setCurrentDate()
{
/* get the current system date and call the "real" function */
//return setCurrentDate(time(NULL);
SYSTEMTIME systt;
return setCurrentDate(systt);
}

Line 215 – 240
//OFBool OFDate::setCurrentDate(const time_t &tt)
OFBool OFDate::setCurrentDate(SYSTEMTIME &tt)
{
OFBool status = OFFalse;
#if defined(_REENTRANT) && !defined(_WIN32) && !defined(__CYGWIN__)
// use localtime_r instead of localtime
//struct tm ltBuf;
// struct tm *lt = &ltBuf;
// localtime_r(&tt, lt);
#else
//struct tm *lt = localtime(&tt);
GetLocalTime(&tt);
SYSTEMTIME *lt = &tt;
#endif
if (lt != NULL)
{
/* store retrieved date */
//Year = 1900 +lt->wYear;
Year = lt->wYear; //right or not ???
Month = lt->wMonth + 1;
Day = lt->wDay;
/* report that current system date has been set */
status = OFTrue;
}
return status;
}


/*ofdate.h*/ line 235
//OFBool setCurrentDate(const time_t &tt);
OFBool setCurrentDate(SYSTEMTIME &tt);
/*ofdatime.cxx*/ line 162-167
OFBool OFDateTime::setCurrentDateTime()
{
/* set current system date and time, use the same "time_t" struct to avoid inconsistencies */
//time_t tt = time(NULL);
SYSTEMTIME sytt;
//return Date.setCurrentDate(tt) && Time.setCurrentTime(tt);

return Date.setCurrentDate(sytt) && Time.setCurrentTime(sytt);
}

/*offname.cxx*/ line 57 – 69

OFFilenameCreator::OFFilenameCreator()
: creation_time(0)
{

//creation_time = OFstatic_cast(unsigned long, time(NULL));
//time_t tt;
SYSTEMTIME systt;
GetLocalTime(&systt);
FILETIME ftime;
SystemTimeToFileTime(&systt,&ftime);
creation_time=OFstatic_cast(unsigned long,(ftime.dwHighDateTime&0xFFFFFFFF00000000 ) | ftime.dwLowDateTime);

}

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

mofify the function about process and convert character set

#6 Post by jixiang »

Wince处理进程的函数和win32不一样,用相关的函数替换。
Ofstd包的字符串转换完毕,编译ofstd包成功。
ofstdinc.h line 132 didn't include cerrno,copy it from win32

ofstd.cxx line 121
wince没有io.h文件,io.h有函数access的声明,注释掉io.h,用GetFileAttributes替换掉access。


#ifdef HAVE_IO_H
//#include <io.h> /* for access() on Win32 */

wince didn't have io.h,removing it and using GetFileAttribute to take the place of the access.

line 306-310
#if HAVE_ACCESS
/* check whether path exists */
//result = (access(pathName.c_str(), F_OK) == 0);
result = (GetFileAttributes(AnsiToUnicode(pathName.c_str())) != 0xFFFFFFFF);
#else
Line 383-388
OFBool OFStandard::isReadable(const OFString &pathName)
{
#if HAVE_ACCESS
//return (access(pathName.c_str(), R_OK) == 0);
return (GetFileAttributes(AnsiToUnicode(pathName.c_str())) != 0xFFFFFFFF);
#else

Line 401-404
#if HAVE_ACCESS
//return (access(pathName.c_str(), W_OK) == 0);
return (GetFileAttributes(AnsiToUnicode(pathName.c_str())) != 0xFFFFFFFF);
#else

Ofthread.cxx
Line 52-53
#include <windows.h>
//#include <process.h> //注释掉process.h,用别的函数替换头文件里声明的函数

Line 94-99
#ifdef HAVE_WINDOWS_H
//unsigned int __stdcall thread_stub(void *arg)
//重新定义返回值匹配的由线程创建函数调用的函数。
unsigned long __stdcall thread_stub(void *arg)
{
OFstatic_cast(OFThread *, arg)->run();
return 0; // thread terminates
}





Line 139 -141
//unsigned int tid = 0;
unsigned long tid = 0; //用CreateThread函数替换_beginthreadex
//theThreadHandle = _beginthreadex(NULL, 0, thread_stub, (void *)this, 0, &tid);
theThreadHandle =(unsigned long) CreateThread(NULL,0,thread_stub,(void*)this,0,&tid);

line 217-219
#ifdef WINDOWS_INTERFACE
// _endthreadex(0);
ExitThread(0); //用ExitThread(0)替换_endthreadex(0)

Line 260,386,527,657,927 LPWSTR替换LPTSTR

Ofthread.h
Line 52 -53
// unsigned int __stdcall thread_stub(void *arg);
unsigned long __stdcall thread_stub(void *arg);

line 195-196
//friend unsigned int __stdcall thread_stub(void *arg);
friend unsigned long __stdcall thread_stub(void *arg);

另外对不匹配函数参数的字符串进行转换:
strconvert.h
# ifndef _STRCONVERT_H
#define _STRCONVERT_H

#define MAXNUM 300
//wchar_t wideCharStr[MAXNUM ];
//char multiByteStr[MAXNUM ];
#include <Windows.h>
void GetErrorMessage();
wchar_t* AnsiToUnicode(PCSTR pMultiByteStr);
char* UnicodeToAnsi(PCWSTR pWcharStr);

#endif







strconvert.cxx
#include "strconvert.h"

wchar_t wideCharStr[MAXNUM ];
char multiByteStr[MAXNUM ];

wchar_t* AnsiToUnicode(PCSTR pMultiByteStr)
{
memset(wideCharStr,0,sizeof(wideCharStr));
int lenOfWidechar = 0;
int IsSuccess = 0;


lenOfWidechar = MultiByteToWideChar(CP_ACP,0,pMultiByteStr,-1,NULL,0);
if(MAXNUM<lenOfWidechar)
{
GetErrorMessage();

}

IsSuccess = MultiByteToWideChar(CP_ACP,0,pMultiByteStr,-1,wideCharStr,lenOfWidechar);
if(!IsSuccess)
{
GetErrorMessage();

}

return wideCharStr;

}

char* UnicodeToAnsi(PCWSTR pWcharStr)
{
memset(multiByteStr,0,sizeof(multiByteStr));
int lenOfMultiByteChar = 0;
int IsSuccess = 0;


lenOfMultiByteChar = WideCharToMultiByte(CP_ACP,0,pWcharStr,-1,NULL,0,NULL,NULL);
if(MAXNUM<lenOfMultiByteChar)
{
GetErrorMessage();
}


IsSuccess = WideCharToMultiByte(CP_ACP,0,pWcharStr,-1,multiByteStr,lenOfMultiByteChar,NULL,NULL);
if(!IsSuccess)
{

GetErrorMessage();
}


return multiByteStr;
}

void GetErrorMessage()
{
LPVOID lpMsgBuf;
DWORD error = GetLastError();
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error,
0,
(LPTSTR)&lpMsgBuf,
0,
NULL);


MessageBox( NULL, (LPCTSTR)lpMsgBuf, L"Error", MB_OK | MB_ICONINFORMATION );

LocalFree(lpMsgBuf);
}
需要字符串转换的文件主要有:ofstd.cxx(309,340,363,387,403,482,488,490,499,504,508,510) , ofcmdln.cxx(971-999)

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

not getenv() and strerror()?how to solve?

#7 Post by jixiang »

I have compiled ofstd package successfully.the dcmdata and dcmnet packages have some errors. I read in websites that wince doesn't support getenv() function and strerror (errno) function.suggest me the ways to solve this problem.

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#8 Post by Michael Onken »

Hi,

I don't have any inisight, but maybe searching on google already gives some ideas, like this one.

Good luck!
Michael

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

defined a function to replace strror(errno)

#9 Post by jixiang »

solved question:
I have replaced the strror(errno) with a wrapped function GetErrorMessage.
the code:
#include <errno.h>
#include <Windows.h>
#include <strconvert.h>

int GetErrorMessage(char* errorMsg)
{
DWORD dwError = GetLastError();
DWORD systemLocale = MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL);
BOOL fok = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
dwError,
systemLocale,
AnsiToUnicode(errorMsg),
0,
NULL);
if(!fok)
{
printf("fail to obtain errmsg\n");
return 0;
}

return 1;

}


unsolved qustion:

An old qustion is that wince have not the concept of environment variable.
how to get the "DCMDICTPATH" to load data dictionary?how to replace the function getenv()?

some source codes in dcmtk:
// environment variable pointing to the data dictionary file
#define DCM_DICT_ENVIRONMENT_VARIABLE "DCMDICTPATH"

OFBool
DcmDataDictionary::loadExternalDictionaries()
{
const char* env = NULL;
int len;
int sepCnt = 0;
OFBool msgIfDictAbsent = OFTrue;
OFBool loadFailed = OFFalse;

env = getenv(DCM_DICT_ENVIRONMENT_VARIABLE);
if ((env == NULL) || (strlen(env) == 0)) {
env = DCM_DICT_DEFAULT_PATH;
msgIfDictAbsent = OFFalse;
}

if ((env != NULL) && (strlen(env) != 0)) {
len = strlen(env);
for (int i=0; i<len; i++) {
if (env == ENVIRONMENT_PATH_SEPARATOR) {
sepCnt++;
}
}

if (sepCnt == 0) {
if (!loadDictionary(env, msgIfDictAbsent)) {
return OFFalse;
}
} else {
char** dictArray;

dictArray = OFstatic_cast(char **, malloc((sepCnt + 1) * sizeof(char*)));

int ndicts = splitFields(env, dictArray, sepCnt+1,
ENVIRONMENT_PATH_SEPARATOR);

for (int ii=0; ii<ndicts; ii++) {
if ((dictArray[ii] != NULL) && (strlen(dictArray[ii]) > 0)) {
if (!loadDictionary(dictArray[ii], msgIfDictAbsent)) {
loadFailed = OFTrue;
}
}
free(dictArray[ii]);
}
free(dictArray);
}
}

return (loadFailed) ? (OFFalse) : (OFTrue);
}

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#10 Post by Jörg Riesmeier »

I my opinion, there is no need to support the DCMDICTPATH environment variable on Windows CE. You should probably just use the built-in data dictionary and/or use the default path specified in the macro DCM_DICT_DEFAULT_PATH.

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

how to solve the question of process ?

#11 Post by jixiang »

{
// win32 code to create new child process
HANDLE childSocketHandle;
HANDLE hChildStdInRead;
HANDLE hChildStdInWrite;
HANDLE hChildStdInWriteDup;

SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = TRUE;
sa.lpSecurityDescriptor = NULL;

// prepare the command line
OFString cmdLine = command_argv[0];
cmdLine += " --forked-child";
for (int i=1; i < command_argc; ++i)
{
cmdLine += " ";
cmdLine += command_argv;
}

// create anonymous pipe
if (!CreatePipe(&hChildStdInRead, &hChildStdInWrite, &sa,0))
{
char buf4[256];
sprintf(buf4, "Error %i while creating anonymous pipe",OFstatic_cast(int, GetLastError()));
return makeDcmnetCondition(DULC_CANNOTFORK, OF_error, buf4);
}

// create duplicate of write end handle of pipe
if (!DuplicateHandle(GetCurrentProcess(),hChildStdInWrite,
GetCurrentProcess(),&hChildStdInWriteDup,0,
FALSE,DUPLICATE_SAME_ACCESS))
{
return makeDcmnetCondition(DULC_CANNOTFORK, OF_error, "Error while duplicating handle");
}

// destroy original write end handle of pipe
CloseHandle(hChildStdInWrite);

// we need a STARTUPINFO and a PROCESS_INFORMATION structure for CreateProcess.
STARTUPINFO si;
PROCESS_INFORMATION pi;
memset(&pi,0,sizeof(pi));
memset(&si,0,sizeof(si));

// prepare startup info for child process:
// the child uses the same stdout and stderr as the parent, but
// stdin is the read end of our anonymous pipe.
si.cb = sizeof(si);
si.dwFlags |= STARTF_USESTDHANDLES;
si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
si.hStdError = GetStdHandle(STD_ERROR_HANDLE);
si.hStdInput = hChildStdInRead;

// create child process.
if (!CreateProcess(NULL,OFconst_cast(char *,cmdLine.c_str()),NULL,NULL,TRUE,0,NULL,NULL,&si,&pi))
{
char buf4[256];
sprintf(buf4, "CreateProcess failed: (%i)",(int)GetLastError());
return makeDcmnetCondition(DULC_CANNOTFORK, OF_error, buf4);
}
else
{
// PROCESS_INFORMATION pi now contains various handles for the new process.
// Now that we have a handle to the new process, we can duplicate the
// socket handle into the new child process.
if (DuplicateHandle(GetCurrentProcess(), (HANDLE)sock, pi.hProcess,
&childSocketHandle, 0, TRUE, DUPLICATE_CLOSE_SOURCE))
{
// close handles in PROCESS_INFORMATION structure
// and our local copy of the socket handle.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle((HANDLE)sock);

// send number of socket handle in child process over anonymous pipe
DWORD bytesWritten;
char buf5[20];
sprintf(buf5,"%i",(int)childSocketHandle);
if (!WriteFile(hChildStdInWriteDup, buf5, strlen(buf5)+1, &bytesWritten, NULL))
{
CloseHandle(hChildStdInWriteDup);
return makeDcmnetCondition (DULC_CANNOTFORK, OF_error, "error while writing to anonymous pipe");
}

// return OF_ok status code DULC_FORKEDCHILD with descriptive text
char buf4[256];
sprintf(buf4, "new child process started with pid %i, socketHandle %i",
OFstatic_cast(int, pi.dwProcessId),
(int)childSocketHandle);
return makeDcmnetCondition (DULC_FORKEDCHILD, OF_ok, buf4);
}
else
{
// unable to duplicate handle. Close handles nevertheless
// to avoid resource leak.
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
CloseHandle((HANDLE)sock);
return makeDcmnetCondition (DULC_CANNOTFORK, OF_error, "error while duplicating socket handle");
}
}
}

>.\libsrc\dul.cxx(1697) : error C2065: 'STARTF_USESTDHANDLES' : undeclared identifier
1>.\libsrc\dul.cxx(1698) : error C2065: 'STD_OUTPUT_HANDLE' : undeclared identifier
1>.\libsrc\dul.cxx(1698) : error C3861: 'GetStdHandle': identifier not found
1>.\libsrc\dul.cxx(1699) : error C2065: 'STD_ERROR_HANDLE' : undeclared identifier
1>.\libsrc\dul.cxx(1699) : error C3861: 'GetStdHandle': identifier not found
wince have not this concept of getstdHandle and related macro,how to solve it?thanks.

Michael Onken
DCMTK Developer
Posts: 2051
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

#12 Post by Michael Onken »

Hi,

then you will not be able to run DCMTK servers in multi-process mode which maybe is ok on a windows CE system. Just change the code to always return an error if someone tries to call it in your system. You might also want to prohibit the compiler from compiling that original code part by surrounding it with #ifdef (I think it is #ifndef _WIN32_WCE" but dont know for sure) if you do not want to change it.

Best regards,
Michael

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

WinCE doesn't support open()/read/write/close, i.e. no file descriptor-based I/O.

#13 Post by jixiang »

At first,Thank you , Michael Onken . help me a lot.

I compiled cmdlnarg.cxx in dcmdata, some errors:

void prepareCmdLineArgs(int& /* argc */, char** /* argv */,
const char* /* progname */)
{
#ifdef _WIN32
#ifndef DCMTK_GUI
#ifndef __CYGWIN__
/* Map stderr onto stdout (cannot redirect stderr under windows).
* Remove any buffering (windows uses a 2k buffer for stdout when not
* writing to the console. since dcmtk uses mixed stdout, stderr
* cout and cerr, this results in _very_ mixed up output).
*/

/* duplicate the stderr file descriptor be the same as stdout */
close(fileno(stderr));
int fderr = dup(fileno(stdout));
if (fderr != fileno(stderr));
{
ofConsole.lockCerr() << "INTERNAL ERROR: cannot map stderr to stdout: " << strerror(errno) << endl;
ofConsole.unlockCerr();
}

#ifndef NO_IOS_BASE_ASSIGN
/* make cout refer to cerr. This does not work with all iostream implementations :-( */
cout = cerr;
#endif

/* make stdout the same as stderr */
*stdout = *stderr;#ifndef __BORLANDC__ /* setvbuf on stdout/stderr does not work with Borland C++ */
/* make sure the buffering is removed */
if (setvbuf(stdout, NULL, _IONBF, 0 ) != 0 )
{
ofConsole.lockCerr() << "INTERNAL ERROR: cannot unbuffer stdout: " << strerror(errno) << endl;
ofConsole.unlockCerr();
}
if (setvbuf(stderr, NULL, _IONBF, 0 ) != 0 )
{
ofConsole.lockCerr() << "INTERNAL ERROR: cannot unbuffer stderr: " << strerror(errno) << endl;
ofConsole.unlockCerr();
}
#endif /* __BORLANDC__ */
#endif
#endif
#endif

/* no need to process the arguments */
}

#endif

正在编译...
1>cmdlnarg.cxx
1>.\libsrc\cmdlnarg.cxx(117) : error C3861: 'close': identifier not found
1>.\libsrc\cmdlnarg.cxx(119) : error C3861: 'dup': identifier not found
1>.\libsrc\cmdlnarg.cxx(138) : error C2100: illegal indirection
1>.\libsrc\cmdlnarg.cxx(138) : error C2100: illegal indirection
1>.\libsrc\cmdlnarg.cxx(138) : error C2106: '=' : left operand must be l-value
my qustion:
1.WinCE doesn't support open()/read/write/close and file descriptor-based I/O.I have no idea.
2.*stdout = *stderr
the line will result in illegal indirection. I find that the definition
of stdin and stdout has some different between win32 and wince.

the definition in win32:

#ifndef _STDSTREAM_DEFINED
#define stdin (&__iob_func()[0])
#define stdout (&__iob_func()[1])
#define stderr (&__iob_func()[2])
#define _STDSTREAM_DEFINED
#endif


the definition in wince:

// Std handle defns
#define stdin _getstdfilex(0)
#define stdout _getstdfilex(1)
#define stderr _getstdfilex(2)

// functions for general buffered file handling in either ANSI or Wide
_CRTIMP __checkReturn FILE* __cdecl _getstdfilex(int _FileHandle);

jixiang
Posts: 9
Joined: Mon, 2010-10-18, 10:05

storescp,storescu,echoscu have run successfully

#14 Post by jixiang »

At present ,storescu,storescp,echoscu have compiled and run sucsussfully. storescu.exe can run on wince and transfer file from wince to win32 platform (my pc).Thank all friends.

At the beginning,I compiled the dcmnet using cmake and conifged the platform for wince in vs2005.There will be a lot errors because
wince and win32 have different lib and head files.there are some unsolved qustion.
Later,I give up the cmake and create new project and add related resource files and head files into my project.In this way,you can obtain a real wince environment.then,you can do some work to replace the win32 fuctins or overwrite some functions.
In addition,you need pay attentions toi nternal dependencies .so,you should comiple the lib follow the sequence.if someone have interested in it ,we can discusss it .good luck.
• dcmdata: ofstd
• dcmimage: dcmimgle, dcmdata, ofstd
• dcmimgle: dcmdata, ofstd
• dcmjpeg: ijg8, ijg12, ijg16, dcmimage, dcmimgle, dcmdata, ofstd
• dcmnet: dcmdata, ofstd
• dcmpstat: dcmimage, dcmimgle, dcmsign, dcmsr, imagectn, dcmtls, .dcmnet, dcmdata, ofstd
• dcmsign: dcmdata, ofstd
• dcmsr: dcmdata, ofstd
• dcmtls : dcmnet, dcmdata, ofstd
• dcmwlm: dcmnet, dcmdata, ofstd
• imagectn/dcmqrdb: dcmnet, dcmdata, ofstd
Last edited by jixiang on Tue, 2011-01-04, 10:59, edited 1 time in total.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest