Skip navigation
Currently Being Moderated

Creating C++ objects inside an exporter plugin (CS6 SDK)

Feb 20, 2013 11:01 PM

Tags: #exporter_api

I have downloaded the Adobe CS6 SDK.  In the exporter example, inside exSelBeginInstance(), there are calls to "memory suite" API.  This grabs some memory (at runtime) for a C-struct/array.

 

In my case, I need to call the new() operator on a derived C++ class.  The idea is that I'll create the object during exSelBeginInstance(), then delete it during exSelEndInstance.


If I use the new() operator, then the memory-suite won't know about the object at all. Alternatively, I could call the memory-API to grab a chunk of memory the size of "sizeof(my_class)"  But this doesn't work correctly either, because the object itself may need to create instances of other classes.

 

So is there a way to safely use dynamically created C++ objects inside an exporter plugin? Or do I have re-architect everything to avoid calling the new() constructor?

 
Replies
  • Currently Being Moderated
    Feb 21, 2013 4:05 PM   in reply to nvenc4everyone

    the adobe memory suite shouldn't be used for that sort of thing.

    just use the new operator as you normally would.

    the key is to store all the pointers to your dynamically allocated in the lRec (ie the private data) so that on EndInstance you can take responsibility for all of the delete(lRec->xxxxx) you need to do to properly clean up.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points