{ const char ** valueArray = (const char **)malloc(sizeof(char*)*4); valueArray[0] = "hi"; valueArray[1] = "there"; valueArray[2] = "a"; valueArray[3] = "b"; test->Test6(4,valueArray); } { printf("--[c++]about to test7\n"); PRUint32 count; char *charArray; test->Test7(&count,&charArray); for (int i = 0; i < count; i++) { printf("--[c++] charArray[%d]=%c\n",i,charArray[i]); } printf("--[c++]end of test7\n"); }
void test() {    printf("--BlackConnect test start\n");    nsresult r;    bcIJavaSample *test;    bcIJavaSample *a = new bcJavaSample();    r = nsComponentManager::CreateInstance("bcJavaSample",					   nsnull,					   NS_GET_IID(bcIJavaSample),					   (void**)&test);    if (NS_FAILED(r)) {        printf("--[debug] can not load bcJavaSample\n");        return;    }    //sigsend(P_PID, getpid(),SIGINT);    //test->Test1(2000);    test->Test1(1000);    bcIJavaSample *test1;    if (NS_FAILED(r)) {        printf("failed to get component. try to restart test\n");    } else {        test->Test2(a);    }    test->QueryInterface(NS_GET_IID(bcIJavaSample),(void**)&test1);    int intArray[] = {1,2,3};    test->Test3(3, intArray);    {        char ** valueArray = (char **)malloc(sizeof(char*)*4);        valueArray[0] = "hi";        valueArray[1] = "there";        valueArray[2] = "a";        valueArray[3] = "b";        char *** valueArray2 = &valueArray;        test->Test4(4,valueArray2);        for (int i = 0; i < 4; i++) {            printf("valueArray2[%d]=%s\n",i,(*valueArray2)[i]);        }    }    {                nsIComponentManager* cm;        nsresult rv = NS_GetGlobalComponentManager(&cm);        printf("--[c++] bcJavaSample before test->Test5(cm)\n");        test->Test5(cm);        nsIEnumerator *enumerator;        rv = cm->EnumerateCLSIDs(&enumerator);        if (NS_FAILED(rv)) {            printf("--[c++] can get enumerator\n");        }        printf("--[c++] bcJavaSample after test->Test5(cm)\n");    }    printf("--BlackConnect test end\n");}