Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++
I have written simple program consisting of an array listing names of cities and just printing them.
 
I have created a dll library of it.
 
Now can I modify the array( to add some more names of cities ) in library through some other C program?
Posted 18-Jan-13 0:18am
Edited 18-Jan-13 0:59am
CPallini335.8K
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Another possibility would be to have your dll search for the presence of a file that contains your editable list, and if found, load that up. If it's not there, then you could default to the list you have hardcoded into your dll. That way, you can add cities by appending them to your file without having to recreate the dll each time you want to add a city.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Create a method that returns the data as a STL list[^]. Then your code can either add to the list itself, or have another method in the DLL that will add items to it. However, remember that the extra items will not be persisted inside the DLL. If you want the list to be updated permanently then it would be much easier to rebuild from the source.
  Permalink  
Comments
CPallini at 18-Jan-13 6:03am
   
Warning, passing STL objects across DLL boundaries is dangerous:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q172396
Richard MacCutchan at 18-Jan-13 7:00am
   
Oops, forgot about that.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Peter Leow 313
1 Kornfeld Eliyahu Peter 220
2 Maciej Los 160
3 Sergey Alexandrovich Kryukov 157
4 OriginalGriff 153
0 Peter Leow 443
1 OriginalGriff 403
2 Kornfeld Eliyahu Peter 260
3 Sergey Alexandrovich Kryukov 242
4 Maciej Los 230


Advertise | Privacy | Mobile
Web02 | 2.8.150301.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100