您的位置:首页 > 其它

how to port libjpeg8c to window …

2014-01-15 12:17 330 查看
how to port libjpeg8c to window mobile platform
- Ba_jian, Nanjing

The libjpeg8c already has Windows version, which could be directly
build under
command line of windows. You can use
makefile.vc to create VC projects.

To port it to windows mobile, also you can manually do
like:
1) create an windows
mobile projects;
2) drop all *.h, *.c files
to that folder, and add them to the current project
3) remove
all test app files, cdjpeg, cjpeg,djpeg, tranxxx.h/c, rdxxx.h/c,
wdxxx.h/c,





example.c,...
4) remove
almost all jmemxxxx.c, only left jmemnobs.c
(
since tmpfile() is not supported in wince, which is used by
jmemansi.c)

5) #define
NO_GETENV in "jmemmgr.c" because getenv() is not supported in Win
CE.

(if you use jconfig.vc -> jconfig.h, looks like
no such issue).

=======================================================================================
Appendix A: how to create static lib using visual studio

=======================================================================================

在“项目类型”窗格中,选择“Visual
C++”下的“Win32”。

在“模板”窗格中,选择“Win32
控制台应用程序”。

为项目选择一个名称(例如 MathFuncsLib),并将该名称输入“名称”字段。 为解决方案选择一个名称(例如
StaticLibrary),并将该名称输入“解决方案名称”字段。

单击“确定”启动 Win32
应用程序向导。 在“Win32
应用程序向导”对话框的“概述”页中,单击“下一步”。

在“Win32 应用程序向导”的“应用程序设置”页中,选择“应用程序类型”下的“静态库”。

在“Win32 应用程序向导”的“应用程序设置”页中,清除“附加选项”下的“预编译头”复选框。

单击“完成”创建项目。

=======================================================================================

Appendix B: potential issues

=======================================================================================

1. temfile()
not find issue, use jmemnobs.c instead of jmemansi.c

2. getenv() not find issue,
#define NO_GETENV in
jmemmgr.c
3.
warning
LNK1166: cannot adjust code at offset=0x00001000,
rva=0x00001E74


This is a potential issue,
which could crash CPU in TI-chipset, like OMAP9xxxx, it should
be


safe in other ARM chipsets.
To fix it:


(1) enable function level
linking, through project property/C++/Enable function level linking
(/Gy), or


(2) split a big function to
several function, looks like difficut to identify which function,
and change it.


Detailed information for
reference:



(1)http://blog.csdn.net/thesp2/article/details/545591


(2)http://www.cnblogs.com/walzer/archive/2006/02/09/327834.html


(3)http://xiaoli-1346.blog.163.com/blog/static/833798382009731113429/



(4)https://www-304.ibm.com/support/docview.wss?uid=swg21169114


(5)http://www.euyao.com/bbs/viewthread.php?tid=457

=======================================================================================

Appendix C: To use the lib

=======================================================================================

1. typically,
you only need three or maybe 4 header files



libjpeg.h, jerror.h, jconfig.h,
jmorecfg.h

2.
you can directly add the libjpeg.lib through "additional lib files"
in project property, or



#pragma comment(lib, "./libjpeg.lib")

to enable link the
file.

3. Potential compiling issue when a cpp file
include a header file of C, the old

style C
declares a function without parameters, however C++ will meet
error,

just do like
this, when include jpeglib header in your cpp file:

extern "C" {

#ifdef FAR

#undef FAR

#endif



#define
JCONFIG_INCLUDED

#include "jconfig.h" // you
must firstly include jconfig.h,



// then
define H***E_PROTOTYPES, --> caused by a bad
configure, :-P

#define
H***E_PROTOTYPES

#include
"jpeglib.h"

#include
"jerror.h"

#include
"jmorecfg.h"

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: