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 17-Jan-13 23:18pm
Edited 17-Jan-13 23:59pm
CPallini313.7K
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 OriginalGriff 255
1 Sergey Alexandrovich Kryukov 150
2 BotCar 105
3 Richard MacCutchan 100
4 ChauhanAjay 95
0 Sergey Alexandrovich Kryukov 9,056
1 OriginalGriff 8,041
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2014
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