Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Exposing PowerScript code via PBNI

11 views
Skip to first unread message

frerichraabe

unread,
Sep 24, 2009, 12:17:50 PM9/24/09
to
Hi,

I'd like to provide a custom PowerScript class as a
PowerBuilder extension. So instead of deliverng it as a
pbl/.pbd, I'd like to exhibit this class as an extension.

Now, I wrote a NVO in C++ which exhibits the class
interface,
but I'm wondering how to exhibit the *implementation* of my
PowerScript class. Two approaches came to my mind:

1.) I tried to find out whether there's any way to provide
the
implementation of class methods in the string returned by
PBX_GetDescription(). It seems the script code returned can
do
a lot of things, but something like this failed:
PBXEXPORT LPCTSTR PBXCALL PBX_GetDescription()
{
static const TCHAR desc[] = _T(
"class mypowerscriptclass from
nonvisualobject\n" \
"function string doStuff( string message
);MessageBox(\"HELLO\",\"WORLD\");\n"
"end function\n"
"end class\n" );
return desc;
}

Just declaring the 'doStuff' function works fine, but it
doesn't
seem to be possible to pass the implementation as
PowerScript
code as well - is it? This would be my preferred solution,
if
it worked.

2.) Making the PowerBuilder extension I wrote in C++ add a
.pbd to the library list of the session as soon as it (the
PowerBuilder extension). Unfortunately I saw no way to do
what
the 'AddToLibraryList' PowerScrpit function does in C++.
Once
an IPB_Session object is created, there doesn't seem to be a
way
to load the library. Is this true? If this worked, the class
exhibited by the PowerBuilder extension could relay all
method
calls to the Invoke() reimplementation to the respective
class
methods of the PowerScript calls.

This solution would be acceptable, but it's inferior to
approach 1) in that I need to deploy two files: the
extension
DLL and the .pbd of the script class which is loaded.

My general issue is that this class needs to do some things
in
C++, and other things which are much more easily expressed
in PowerScript. I'm trying to create a single unit out of
this.

- Frerich

Jeremy Lakeman

unread,
Sep 24, 2009, 9:45:45 PM9/24/09
to
1.
If you're planning on implementing the method in powerscript, why go
through the hastle of building a PBNI extension? Basically this isn't
something PBNI is designed to do.

2.
You can call any system function from PBNI including addtolibrarylist
in the same way you call functions on any other object.
There's even a reference in the help file that seems to explain how.

0 new messages