X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 11 Aug 2012 07:39 PM by  anon
Deal with pointer in DLL
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
11 Aug 2012 07:39 PM
    Recently I want to use dlm to wrap all the c++ functions to read .dwg format file ! First, I made a simple start to begin with one object of polyline. then I construct the polyline struct as this: struct AcDbPolyline{ IDL_LONG numverts; IDL_LONG color[3]; double* vertices; IDL_STRING layer; }; because vertices' number is uncertain,so I made it a pointer ! the other fields can be easily done. I do not find any example in "calling c from IDL" in chapter 7 that can teach me to deal with the problem ! I am eager to known how can you all smart guys can do this when creating IDLFFDXF object and its entity,such as IDL_DXF_POLYLINE ! VERTICES Pointer (to an array of 3-D points) CONNECTIVITY Pointer (to an array of integers) VERTEX_COLORS Pointer (to an array of integers) how should I deal with the pointer in dll ! hoping for your early reply!

    Deleted User



    New Member


    Posts:21
    New Member


    --
    15 Aug 2012 11:07 AM
    Hi, Well, we do not currently expose the pointer or object API to the C-code developer. This is primarily because it is tricky to get correct, and is difficult to explain. Also, it is kind of a pain to return pointers to users. They need to understand how pointers work, and how to not leak them. The garbage collection (added in IDL 8.0) helps with this, but you can still end up with leaks if you assign pointers to common blocks, etc. So we try to avoid returning pointers wherever possible (except for a few special cases). So, I would recommend that you return your data as a simple array of numbers. It is easier for you to code, and easier for the end users. Hope this helps! Cheers, Chris ExelisVIS
    You are not authorized to post a reply.