Hmm, went thru the source code to find all FindClass() usages to check them out.
There is one case where AttachThread() - returning a thread context - is used
and where FindClass()
would find a context class (one that is definitely not in .environment). Not
sure why, not sure
whether an error or not, but wanted to report it, therefore I enclose that code
snippet below.
If this is indeed an error then please let me know as I would need to solve the
problem differently
then as the code is dependent on getting access to that class.
---rony
P.S.: Code snippet that is able to find a non-.environment-class with
FindClass():
//
--------------------------------------------------------------------------------
void new_connection_callback (DBusServer *server, DBusConnection *conn,
void *data) // callback on new connection
{
PSTRUCT_CALLBACK_DATA cbd=(PSTRUCT_CALLBACK_DATA) data;
RexxThreadContext *rtc=NULL;
logical_t rc=cbd->*rxInstance->AttachThread(&rtc);* //
attach to Rexx interpreter instance
if (rc==false)
{
fprintf(stderr, "%.16s/\"new_connection_callback(...)\", fatal
error # 1: cannot attach thread to saved Rexx interpreter instance, aborting
with 'exit(-1)'\n", DLLNAME);
fflush(stderr),
exit(-1);
}
// can the connection be anonymous ?
if (rtc->SendMessage0(cbd->rxDbusServer, "ALLOWANONYMOUS") ==
rtc->True())
{
dbus_connection_set_allow_anonymous(conn, true);
}
dbus_connection_ref(conn); // let this connection be kept open
// define pseudo-address for connection
RexxStringObject rsoDT=GET_REXX_DATE_TIME_AS_REXX_STRING(rtc);
RexxStringObject rsoAddr=rtc->String("native:connectionFromclient@");
RexxStringObject rsoAddrWithDT=(RexxStringObject)
rtc->SendMessage1(rsoAddr, "||", rsoDT);
// create an instance of DBus (a connection)
RexxClassObject rco=*rtc->FindClass("DBUS");* // get class
RexxObjectPtr rxDBusConn=rtc->SendMessage1(rco, "NEW",
rtc->String("native")); // get DBus (bus connection) object
// RexxObjectPtr rxDBusConn=rtc->SendMessage0(rco, "NEW"); // get DBus
(bus connection) object
rtc->SendMessage1(rxDBusConn, "PSEUDOADDRESS=", rsoAddrWithDT); // set
CSELF
// save conn in a Rexx pointer object and save it as CSELF
RexxPointerObject rpo = rtc->NewPointer(conn);
rtc->SendMessage1(rxDBusConn, "CSELF=", rpo); // set CSELF
// rtc->SendMessage1(rxDBusConn, "BUSTYPE=", rtc->String("private"));
// set bus type
rtc->SendMessage1(rxDBusConn, "SERVER=", cbd->rxDbusServer); //
set server this connection belongs to
// let Rexx code setup (save to connections, assigning default
service and listener objects)
rtc->SendMessage1(cbd->rxDbusServer, "NEWCONNECTION", rxDBusConn);
}
On 31.07.2014 13:52, Rony G. Flatscher wrote:
> On 31.07.2014 13:44, Rick McGuire wrote:
>> FindClass is a thread context API, which is invoked outside of the context
>> of any running code.
>> As such, it is limited to locating those classes that are provided by the
>> system (i.e., in
>> .environment). FindContextClass performs the same sort of search that would
>> occur in any piece
>> of Rexx code where it can find any classes defined in your package as well
>> as any public classes
>> pulled in by other packages that code has loaded (via ::requires, for
>> example).
> Ahh, thank you very much!
>
> ---rony
>
>
>>
>> On Thu, Jul 31, 2014 at 7:38 AM, Rony G. Flatscher <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>> What is the differenct between FindClass() and FindContextClass()?
>>
>> The documentation for FindClass() says: "Locates a Class object in the
>> current thread context."
>>
>> The documentation for FindContextClass() says: "Locate a Class object in
>> the current Method or
>> Routine Package context."
>>
>> Both functions are available for native routines. The (public) class
>> that cannot be found by
>> FindClass() is defined in the package that invoked the native Rexx
>> routine. Actually the
>> native Rexx
>> routine is called from methods of that class, that cannot be found.
>>
>> FindContextClass() will find that (public) class.
>>
>> ---rony
>>
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel