× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I have a number of C++ classes that handle strings ( basic strings, command
strings, comma sep value strings, ... ).  Nothing platform specific at all.
How can I best call the member functions of these classes from rpg?  Can ILE
pass the "this" pointer needed when calling class member functions?

Here is one method that I have not yet tested, but I am sure works.

Write some static marshalling functions in C++ ( a static function, if I
have the terminology correct, does not have an implicit "this" pointer ).
The rpg code calls the marshalling code with a this pointer ( pointer to the
class object ) and also the arguments to the member function. The
marshalling function then calls the c++ class member function.

// CsvString - comma separated value string.
 class CsvString : private string
   {
  public:
    void  AddValue( char* sValue ) ; // add to comma sep value string.
    char* GetValue( int nIx ) ;  // get vlu from comma sep vlu string.
    char* GetString( ) ;         // return the entire string.
   } ;

// new and delete the CsvString object.
 void* CsvString_New( ) ;
 void  CsvString_Delete( void* pCsvString ) ;

// marshall calls to the CsvString member functions.
 void  CsvString_AddValue( void* pThis, char* sValue ) ;
 char* CsvString_GetValue( void* pThis, int nIx ) ;
 char* CsvString_GetString( void* pThis ) ;


-Steve Richter



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.