Click here to Skip to main content
12,756,933 members (40,438 online)
Rate this:
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
Updated 18-Jan-13 0:59am
Rate this: bad
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.
Rate this: bad
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.
CPallini 18-Jan-13 6:03am
Warning, passing STL objects across DLL boundaries is dangerous:;EN-US;Q172396
Richard MacCutchan 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2017
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