Quote
It's just a naming convention ( i'm a delphi programmer and i'm just following the delphi classes naming convention ) that's all .
I'm still curious as to what 'Idenety' means, but perhaps it's not important.
Quote
I'm looping to get all Users's information and store them in the UserIdentity ; something like creating an array of UserIdentity
I haven't done much with Windows in a while, so I'm not going to comment on the DLL aspect of things. There may of course be additional considerations related to that.
Your original implementation doesn't do what you want (as you probably know by now). All it does (as pcmaster pointed out) is write the name-ID pairs to the same UserIdentity instance repeatedly. If the map is empty, the UserIdentity instance will be unaltered. If the map contains one entry, you may get the desired results (more or less), but only circumstantially. If the map has more than one entry, only the last one will be recorded.
'UserIdentity *' could also be treated as an array. You're not treating it as one though, and you'd need knowledge of its size to write to it safely. 'UserIdentity **_UserIdentity' might be appropriate if you wanted the function to be responsible for creating the array. Typically though, in that case you'd just create the array locally and return it, I would think (although in both cases you'd probably need to convey the size of the array to the user somehow). Lastly, barring other considerations (again, I'm not addressing the DLL issue here), it's common to use RAII containers such as std::vector for things like this to alleviate the burden of manual memory management (and to avoid the kinds of bugs that can come with it).
I think the most straightforward implementation of a function like this would create a std::vector instance locally, populate it, and return it. Again though, perhaps there are other considerations at play.
Edit: Minor correction.