C API guru help needed!

Anyone who knows how to write code to see which LotusScript subs/functions are defined in a script library using the C API?

It’s not illegal or anything!! 🙂

7 thoughts on “C API guru help needed!”

  1. It is not easy to get list of subs from LS lib since you get only long string of source code of whole LS lib.
    The output is similar to export feature of domino designer.


  2. I was hoping you could get a listing like the list of entry points a DLL exports when programming on Windows. That’s what I’m really after. I’m guessing there must be something like it for the LotusScript compiler to use when compiling an agent against a script library.


  3. Easiest way to get a list is to export the library to DXL and parse the “code” nodes; each node has an “event” attribute that specifies the name of the function / sub. Sadly, since any classes are all lumped together in Declarations, this only works for top-level routines… to get class methods you’d have to do syntactical parsing of the grandchild of the Declarations node.


  4. The C API does not allow you to specifically address specific subs, functions and classes defined in a script library. Since each library is a document in the NSF that you can read, you must parse the entire document(s) yourself to get that list. Same issue for trying to expose LS class members.


  5. Maybe I’m off by a bit, but you could just scan the code for any use of the keyword “Alias”. At least, I think that’s what you’re referring to. If you mean the functions that come out of an import via Uselsx, then I don’t think there’s an easy way to do that.


  6. You can get $ScriptLib field via C API application and then you have to parse it your own way.

    I mean, procedures begins with “++LotusScript Development Environment”. You can parse this field value (Source Code of Script library) using String Parse methods.

    How can you get this field ?

    Answer :

    Create new Win32 console application via MS Visual C++ 6.0 and set Project Properties to write code for Lotus Notes Include main/necessary include files.(You can find Notes C API toolkit from IBM web site and also there are more samples to find solution)

    in the main function. Initilize notes using

    /* Domino and Notes initialization */
    if (error = NotesInitExtended (argc, argv))
    printf(“n Unable to initialize Notes.n”);
    return (1);

    Then get target database. You can use this function.

    DBHANDLE LNPUBLIC GetDatabase (char *chrFullPathName)


    STATUS nError = NOERROR;

    // Get Database – STARTED
    if (nError = NSFDbOpen (chrFullPathName, &hCustomDB))
    PrintAPIError (“GetDatabase”, nError);
    return (NULLHANDLE);
    // Get Database – FINISHED

    return (hCustomDB);


    Usage :
    hDB = GetDatabase(“CN=APPDEV01/O=BESTCODER!!Sample.nsf”);

    hDB = GetDatabase(“C:LotusNotesDataSample.nsf”);


    Get target script library (Note)

    // ———————————
    WORD wRetLen;
    char szFieldValue[DESIGN_FIELD_MAX+1];
    char chrElementNam[DESIGN_FIELD_MAX+1];

    nError = NIFFindDesignNote (hDB, “LS Library Note Name”, NOTE_CLASS_FILTER, &IDLSNote);
    if (nError != NOERROR )
    return FALSE;

    nError = NoteOpen (hNoteVERSION, IDLSNote, &hLSNote);
    if (nError != NOERROR )
    return FALSE;

    wRetLen = NSFItemGetText(hNote, “$ScriptLib”, szFieldValue, (WORD) sizeof(szFieldValue));

    sprintf(chrCodes, “%s”, szFieldValue);

    // Now you have LS Library procedures in chrCodes

    NSFNoteClose (hLSNote);

    NSFDbClose (hDB);

    // ———————————

    I hope, this post will help you to find solution. And sorry, it covered big area on this page.

    Ferhat Ikbal BULUT


Comments are closed.