Xojo Conferences
XDCMay2019MiamiUSA

Issues regarding structures (Real Studio Plugins Mailinglist archive)

Back to the thread list
Previous thread: REALdbDatabase
Next thread: (no subject)


macosx and unix paths   -   GOLD
  Issues regarding structures   -   Ashukla in.safenet-inc.com
   Re: Issues regarding structures   -   Nick Lockwood
    RE: Issues regarding structures   -   Ashukla in.safenet-inc.com

Issues regarding structures
Date: 29.06.04 13:14 (Tue, 29 Jun 2004 17:44:10 +0530)
From: Ashukla in.safenet-inc.com
I have a C based API which i want to export to REALbasic through
RealRegistermethod. Now the issue is that few of the functions of the API
take structure as a parameter, i cannot pass struct as a parameter from
REALbasic.

1. Now can i pass a class in place of a structure from realbasic
2. Also can i register a struct as a class in realbasic

Alok Shukla
Software Engineer
Safenet Incorporation
India Development Center
Ground Floor, STP-NSIC
NSIC Bhawan, Okhla Industrial Estate
New Delhi 110020
Tel: +91 11 26321398 Mobile - +91 - 9899612127

The information contained in this electronic mail transmission may be
privileged and confidential, and therefore, protected from disclosure. If
you have received this communication in error, please notify us immediately
by replying to this message and deleting it from your computer without
copying or disclosing it.


_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: Issues regarding structures
Date: 29.06.04 16:30 (Tue, 29 Jun 2004 16:30:58 +0100)
From: Nick Lockwood
> I have a C based API which i want to export to REALbasic through
> RealRegistermethod. Now the issue is that few of the functions of the
> API
> take structure as a parameter, i cannot pass struct as a parameter from
> REALbasic.
>
> 1. Now can i pass a class in place of a structure from realbasic
> 2. Also can i register a struct as a class in realbasic

In both cases the answer is no. Unlike C structs, the internal data
alignment of REALbasic structs is opaque and undocumented, even if you
could pass a REALbasic object as a struct there would be no guarantee
that the data would come out correctly. For example, a c struct might
contain two short (2 byte) integers, but REALbasic has no concept of
short integers so whiole the C struct would be 4 bytes long, the
equaivalent REALbasic object would have 8 bytes, not to mention all the
other crap such as reference counts that is stored in an RB object.

To do what you want you must either pass the data in a memoryblock
(which is what it was designed for), or else provide constructor and
accessor functions to allow the struct to be created from within
REALbasic.

The former option is simpler, but the latter option is more user
friendly if you intend your plugin to be used by other people.

Nick

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

RE: Issues regarding structures
Date: 30.06.04 08:20 (Wed, 30 Jun 2004 12:50:00 +0530)
From: Ashukla in.safenet-inc.com
>To do what you want you must either pass the data in a memoryblock
>(which is what it was designed for), or else provide constructor and
>accessor functions to allow the struct to be created from within
>REALbasic.

Could you refer to me some of the practical understanding regarding
memoryblock and also regarding the second method you suggested.

Alok Shukla

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>