running dll-functions from ReportBuilder

mra

Junior???? Member
Yes! yes! I know that this forum is about Actuate, but there isn't any about ReportBuilder (I wonder why ??)

Anyway! I'm trying to call a DLL function from ReportBuilder, using a calculated field containing:

dllfunc( "TaxiSys.dll", "GetDateString", string( timeStamp ) )

My problem is, that the field contains ???????? as if the DLL returned and error.

As far as I can see, the syntax is OK! Calling the DLL from 4GL works fine.

Any good ideas??



Thanks
Mike


I don't know about you, but I'm powered by black Coffee :)
 

Chris Kelleher

Administrator
Staff member
If you need to use DLLFUNC() in Report Builder to do complex
calculations, that Report Builder does not support, the following
example will show you How to use DLLFUNC() to access an external
DLL containing C code.

STEP BY STEP DETAILS:

DLLFUNC expects a Boolean return value from the called DLL
function. TRUE to indicate the function executed successfully.
FALSE to idicate an error. If the DLL function executes
succesfully, it should overwrite its input string with the output
string to be returned by the Report Builder DLLFUNC.

The function in the DLL must take a character string as an
argument and return a boolean value. The DLL in the example
contains one function, TestDllFunc. If you pass "dog" to this
function, it changes it to "poodle" and returns TRUE. If you
pass anything else, it returns FALSE, which causes Report Builder
to display "????????".

Here is the sample C code, how to declare the function so that RB
can call it.

Code:
#include "windows.h"

BOOL _declspec(dllexport) WINAPI TestDllFunc(LPSTR lpString)
{
    if (!lstrcmp(lpString, "dog"))
    {
        strcpy(lpString, "poodle");
        return TRUE;
    }
    else
        return FALSE;
}

#end of code sample


In the Report you insert a calculated field. In the expression
you call the DLL using function DLLFUNC(dll-name, function-name,
string). If you create a Report using Sports database, insert
cust-num field and the following example in an expression of a
calculated field next to cust-num, it shows the word "poodle" for
the customers with even cust-num. It display "????????" for
customers with odd cust-num.

If you compiled the previous code in c:\work\rbdlltest.dll, use
following expression.

Code:
dllfunc("c:\work\rbdlltest.dll", "TestDllFunc", iif(((cust-num - 
integer(cust-num / 2) * 2) = 0), "dog", "cat"))
 

mra

Junior???? Member
Hi Chriss!

I can get the dll function to work from 4Gl - no problem!
From c++ and VB, there is also no problems.

Hi Chriss!

I can get the dll function to work from 4Gl - no problem!
From c++ and VB, there is also no problems.

I've debugged the dll, and the library is loaded (dllmain is run), but the function is apparently not called.

Can there be a problem with names, name-length, upper/lower case? Do I have to
register the dll somewhere?


Regards
Mike
 
Top