nsSCM::Install 多个依赖之间用什么隔开

Posted on 2010年5月21日 16:57

 nsSCM这个NSIS的插件提供了windows服务注册、启动、停止、卸除的功能,但是官方文档里木有提供nsSCM::Install中关于多个依赖之间用什么隔开,只好查看其源代码了:

 

 

// 7
  char* Depend = STRNEW ();

  if (popstring (Depend))
   {
    STRDEL (Depend);
    STRDEL (LoadGroup);
    STRDEL (ServiceFile);
    STRDEL (ServiceDisplay);
    STRDEL (ServiceName);
    RET_DWORD (rc, Tag);
   }

  /* fixup end of multistring */
  DWORD len = strlen (Depend);
  Depend [len + 1] = 0;

  /* replace comma separator on null separator */
  for (DWORD i = 0; i < len; i++) if (',' == Depend [i]) Depend [i] = 0;

 

可以用逗号隔开 bingo

 

 

C# 获得自定义数据结构的指针地址

Posted on 2010年4月15日 17:22

 

public struct Node
{
        public string Id;
        ......
    }

            Node objNode = new Node();
            objNode.Id = "19830617";
            IntPtr objNodePtr = Marshal.AllocHGlobal(Marshal.SizeOf(objNode));

            try
            {
                Marshal.StructureToPtr(objNode, objNodePtr, false);
                IntPtr tmpPtr = objNodePtr;
                Node tmpNode = (Node)Marshal.PtrToStructure(tmpPtr, typeof(Node));
                ... 这里可以获得 tmpNode.Id;
            }
            finally
            {
                Marshal.FreeHGlobal(objNodePtr);
            }

 

 

libxine 的开发者文档有BUG?!

Posted on 2009年12月29日 17:27

有关用C的OOP的 http://www.xine-project.org/hackersguide#id524081

 

my_stack_t *new_my_stack(void) {
     intstack_t *this;
   
     /* alloc memory */
     this = malloc(sizeof(intstack_t));
   
     /* fill in methods */
     this->push = push;
     this->add  = add;
     this->pop  = pop;
   
     /* init data fields */
     this->stack_size = 0;
   
     /* return public part */
     return &this->stack;
   }

this 指针应该无法访问到push函数指针的地址吧?!

 

 

Is2012 ? TimeStampInValidate : ...

Posted on 2009年12月26日 23:28

Is2012 ? TimeStampInValidate : ...

iPhone 3.0 jialbreak dev

Posted on 2009年12月06日 20:19

 

cd ~/Desktop

vi script

#!/bin/bash
cd /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS\ Build\ System\ Support.xcplugin/Contents/MacOS/
dd if=iPhoneOS\ Build\ System\ Support of=working bs=500 count=255
printf "\x8f\x2a\x00\x00" >> working
dd if=iPhoneOS\ Build\ System\ Support of=working bs=1 skip=127504 seek=127504
/bin/mv -n iPhoneOS\ Build\ System\ Support iPhoneOS\ Build\ System\ Support.original
/bin/mv working iPhoneOS\ Build\ System\ Support
chmod a+x iPhoneOS\ Build\ System\ Support

 

 

libtool suck

Posted on 2009年12月02日 02:57

 

make
/bin/sh /home/xzhai/Download/php-clearsilver-0.4/libtool --mode=compile cc  -I. -I/home/xzhai/Download/php-clearsilver-0.4 -DPHP_ATOM_INC -I/home/xzhai/Download/php-clearsilver-0.4/include -I/home/xzhai/Download/php-clearsilver-0.4/main -I/home/xzhai/Download/php-clearsilver-0.4 -I/usr/lib/php5/include/php -I/usr/lib/php5/include/php/main -I/usr/lib/php5/include/php/TSRM -I/usr/lib/php5/include/php/Zend -I/usr/lib/php5/include/php/ext -I/usr/lib/php5/include/php/ext/date/lib -I/usr/include/ClearSilver  -DHAVE_CONFIG_H  -g -O2   -c /home/xzhai/Download/php-clearsilver-0.4/clearsilver.c -o clearsilver.lo
/home/xzhai/Download/php-clearsilver-0.4/libtool: line 460: CDPATH: command not found
/home/xzhai/Download/php-clearsilver-0.4/libtool: line 1145: func_opt_split: command not found
libtool: Version mismatch error.  This is libtool 2.2.6, but the
libtool: definition of this LT_INIT comes from an older release.
libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6
libtool: and run autoconf again.
make: *** [clearsilver.lo] 错误 63

解决办法 rm aclocal.m4;autoreconf

 

 

xgettext --from-code=UTF-8

Posted on 2009年12月01日 03:31

使用 UTF-8 编码进行 msgfmt -o *.mo *.po,总是报错“无效的多字节序列”;

file *.po 发现编码变成 ISO-8859,然后 xgettext --from-code=UTF-8 重新制作*.po 解决。

extern 外部变量可以在动态链接库之间起作用吗?

Posted on 2009年11月06日 03:00

假设有两个动态链接库libA.dylib、libB.dylib(或者*.so、*.dll),有一个公共头文件HelloGlobal.h,里面有一个extern int GlobalInteger变量,而libA的作用是设置变量的值、libB获得值(setter / getter);

HelloGlobal.h

#ifndef __HELLO_GLOBAL_H__
#define __HELLO_GLOBAL_H__

extern int GlobalInteger;

#endif // __HELLO_GLOBAL_H__

libA.h

#ifndef __LIB_A_H__
#define __LIB_A_H__

void SetGlobalInteger();

#endif // __LIB_A_H__

libA.c

#include "LibA.h"
#include "HelloGlobal.h"

int GlobalInteger;

void
SetGlobalInteger()
{
    GlobalInteger = 101;
}

libB.h

#ifndef __LIB_B_H__
#define __LIB_B_H__

void GetGlobalInteger();

#endif // __LIB_B_H__

libB.c

#include <stdio.h>

#include "LibB.h"
#include "HelloGlobal.h"

int GlobalInteger;

void
GetGlobalInteger()
{
    printf("%s, line %d GlobalInteger %d\n", __FILE__, __LINE__, GlobalInteger);
}

HelloGlobal.c

#include <stdio.h>

#include "HelloGlobal.h"
#include "libA.h"
#include "libB.h"
#include "ExternFile.h"

int GlobalInteger;

int
main()
{
    SetGlobalInteger();
   
    GetGlobalInteger();
   
    ExternSetGlobalInteger();
   
    printf("GlobalInteger %d\n", GlobalInteger);
   
    return 0;
}

 

extern变量在libA和libB动态链接库之间不能作用于“外部”,而使用外部源头件ExternFile.h可以使extern变量作用于外部;

动态链接库之间类似进程之间的通讯 ^_^

GtkGlext examples SConstruct

Posted on 2009年9月30日 18:04

CCFLAGS = ' `pkg-config --cflags gtk+-2.0` '
LINKFLAGS = ' `pkg-config --libs gtk+-2.0` '
__CPPPATH=['/usr/lib/gtkglext-1.0/include', '/usr/include/gtkglext-1.0']
__LIBS=['libgtkglext-x11-1.0']

env = Environment(CCFLAGS=CCFLAGS, LINKFLAGS=LINKFLAGS)
env.Program('simple', 'simple.c', CPPPATH=__CPPPATH, LIBS=__LIBS)

wayland 依赖

Posted on 2009年9月24日 16:50

dev-libs/libffi

eagle

libpng

cairo

gdk-pixbuf-2.0

libudev >= 136

libdrm