Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Oct 16, 2017 5:11 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: How to call global method via dynamic access?
PostPosted: Tue Feb 19, 2008 9:57 am 
Offline

Joined: Sat Oct 01, 2005 5:13 am
Posts: 603
Location: Shanghai, China
I just tried some features of SDK 2.0 included in 2008r1. I called methods of classes successfully. However, failed to call any global method via REALLoadGlobalMethod. The function point always return NULL. Is the function signature I used not right?
   REALarray (*fpSplit)( REALstring s, REALstring delim ) = NULL;
   fpSplit = (REALarray (*)( REALstring, REALstring ))REALLoadGlobalMethod( NULL, "Split( s as String, delim as String = "" ) as String()" );
   if (fpSplit) {
      printf("OK!\n");
   } else {
      printf("Error!\n");
   }

On both Windows and Linux, fpSplit = NULL, haven't tested on Mac.

_________________
ToringoCrypto Plugin - RSA (128 to 1024), DES/3DES/TDEA, etc.
ToringoDRMInfo Plugin - Uniquely identify computers via hardware information.
【My Company: Are you looking for someone to help you work on your projects?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 20, 2008 7:52 am 
Offline

Joined: Sat Oct 01, 2005 5:13 am
Posts: 603
Location: Shanghai, China
I have tested another one, it seems work:

   REALmemoryBlock (*NewMemoryBlock)(long _Size) = NULL;
   NewMemoryBlock = (REALmemoryBlock (*)(long))REALLoadGlobalMethod( NULL, "NewMemoryBlock(size as integer) as MemoryBlock" );


Maybe it was something wrong here...

_________________
ToringoCrypto Plugin - RSA (128 to 1024), DES/3DES/TDEA, etc.
ToringoDRMInfo Plugin - Uniquely identify computers via hardware information.
【My Company: Are you looking for someone to help you work on your projects?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 20, 2008 8:06 am 
Offline

Joined: Sat Oct 01, 2005 5:13 am
Posts: 603
Location: Shanghai, China
It's also worked:
   double (*fpRnd)() = NULL;
   fpRnd = (double (*)())REALLoadGlobalMethod(NULL, "Rnd() As Double");

_________________
ToringoCrypto Plugin - RSA (128 to 1024), DES/3DES/TDEA, etc.
ToringoDRMInfo Plugin - Uniquely identify computers via hardware information.
【My Company: Are you looking for someone to help you work on your projects?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Feb 20, 2008 12:51 pm 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
Looks like you should file a bug report then...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 21, 2008 3:01 pm 
Offline

Joined: Sat Oct 01, 2005 5:13 am
Posts: 603
Location: Shanghai, China
Aaron Ballman wrote:
Looks like you should file a bug report then...


After testing on Mac OS, I'm sure it's a bug now.

_________________
ToringoCrypto Plugin - RSA (128 to 1024), DES/3DES/TDEA, etc.
ToringoDRMInfo Plugin - Uniquely identify computers via hardware information.
【My Company: Are you looking for someone to help you work on your projects?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 21, 2008 3:26 pm 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
It is a bug -- but you also have a bug in your source code. ;-) You cannot load up a function that return an array in the current versions of the SDK. However, even if you could, your call would fail because:

Split( s as String, delim as String = "" ) as String()

is not the same (in C/C++) as:

Split( s as String, delim as String = \" \" ) as String()

which is the correct default parameter value (note, it's the escapes AND a space).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 21, 2008 3:54 pm 
Offline

Joined: Sat Oct 01, 2005 5:13 am
Posts: 603
Location: Shanghai, China
Aaron Ballman wrote:
It is a bug -- but you also have a bug in your source code. ;-) You cannot load up a function that return an array in the current versions of the SDK. However, even if you could, your call would fail because:

Split( s as String, delim as String = "" ) as String()

is not the same (in C/C++) as:

Split( s as String, delim as String = " " ) as String()

which is the correct default parameter value (note, it's the escapes AND a space).


Yes, you are right, the escapes are necessary for c/c++ -- but it means the document is also not right, it's the example I copied from the document of REALLoadGlobalMethod.

_________________
ToringoCrypto Plugin - RSA (128 to 1024), DES/3DES/TDEA, etc.
ToringoDRMInfo Plugin - Uniquely identify computers via hardware information.
【My Company: Are you looking for someone to help you work on your projects?


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Feb 21, 2008 4:03 pm 
Offline
User avatar

Joined: Wed Sep 28, 2005 8:39 am
Posts: 9341
Location: St Augusta, MN
So I see -- thanks for pointing that documentation gaffe out!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group