OSGi 规范的 C/C++ 实现 Apache Celix

码农软件 · 软件分类 · OSGi 框架 · 2019-09-22 09:28:08

软件介绍

Apache Celix 是一个使用 C 和 C++ 实现的 OSGi 规范的项目。提供了使用组件和面向服务编程来开发模块化应用的框架。

一个 C 版本的激活器示例:

//${WS}/myproject/bundles/hello_world/private/src/hello_world_activator.c
#include <stdlib.h>
#include <stdio.h>

#include "dm_activator.h"


struct userData {
        char * word;
};

celix_status_t dm_create(bundle_context_pt context, void **out) {
    celix_status_t status = CELIX_SUCCESS;
    struct userData* result = calloc(1, sizeof(*result));
    if (result != NULL) {
            result->word = "C World";
            *out = result;
    } else {
            status = CELIX_START_ERROR;
    }
    return status;
}

celix_status_t dm_init(void* userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
    struct userData* data = (struct userData *) userData;
    printf("Hello %s\n", data->word);
    return CELIX_SUCCESS;
}

celix_status_t dm_destroy(void* userData, bundle_context_pt context, dm_dependency_manager_pt manager) {
    free(userData);
    return CELIX_SUCCESS;
}

本文地址:https://codercto.com/soft/d/15138.html

The Art of Computer Programming, Volume 4,  Fascicle 3

The Art of Computer Programming, Volume 4, Fascicle 3

Donald E. Knuth / Addison-Wesley Professional / 2005-08-05 / USD 19.99

Finally, after a wait of more than thirty-five years, the first part of Volume 4 is at last ready for publication. Check out the boxed set that brings together Volumes 1 - 4A in one elegant case, and ......一起来看看 《The Art of Computer Programming, Volume 4, Fascicle 3》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具