Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6369635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:49:50+00:00 2026-05-25T00:49:50+00:00

I am putting together a built-in script capability using the excellent Pascal DWScript .

  • 0

I am putting together a built-in script capability using the excellent Pascal DWScript. I have also add my own Delphi-side class definition (TDemo) to DWScript using:

dwsUnit.ExposeRTTI( TDemo.ClassInfo  )

This just works and is a great way of quickly adding properties and methods.

I also wish to add an existing instance in a similar way, so I have created my instance FDemo of type TDemo and then performed:

   dwsUnit.ExposeInstanceToUnit( 'Demo', 'TDemo', FDemo );

This looks a promising routine to call but I get an AV from an uninitialised unit table. I’ve also looked in the unit test code of the SVN source to see the use of this function but to no avail. Can anyone point me at what I should add / change?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:49:50+00:00Added an answer on May 25, 2026 at 12:49 am

    ExposeInstanceToUnit has to be used from within the TdwsUnit table initialization, see RTTIExposeTests/ExposeInstancesAfterInitTable for some sample code. It allows directly exposing dynamic instances.

    The other approach is to use the Instances collection of a TdwsUnit component, you get design-time support, and more controls over your instances and their lifetime.

    Also keep in mind you have to make sure the instances you expose will properly behave even if the script misbehaves, f.i. when the user attempts to manually destroys an instance you exposed, and that instance shouldn’t be destroyed. By default ExposeRTTI will map the destructors, so you may want to restrict that by specifying eoNoFreeOnCleanup.

    edit: a last approach recently added is to use the TdwsRttiConnector, which basically allows exposing and connection to anything that’s reachable through RTTI. That’s very lightweight in terms of code to setup, but the downside is you don’t get any form of compile-time checks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am putting together a php script that pulls html using curl, copies it
I am putting an XSL together than will create a NAnt build script using
I have begun putting together an application using phonegap. I have completed the core
I am putting together a Flash game (using Flixel) and I have a lot
I'm putting together a script to find remove duplicates in a large library of
I am putting together some ideas for our automated testing platform and have been
I'm interested in putting together my first online game using Flash as the client
I'm putting together a simple help system for my WPF app using XAML FlowDcouments
I'm putting together a fixed, one-page site that deploys an overlay using jQuery. There
I'm putting together my own database and from examples I've seen, Foriegn Key can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.