473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Very Important !! Sharing data between a dll and an application

3
//////////////// Inside the APPLICATION/ game
//how do i get the same instance running in the
//dll into my app? i.e the pointer ferrari
//does not work ! it creates a new instance in the
//app and another in the DLL even after sharing

car myferrari = getAvailableFerrari();




////////////////////INSIDE statically linked DLL
////////////////////.h /.lib /.dll

class car{
int x; // int here is used for simplicity but really i
// need an array of class instances

car(){x=40231;}
};
static car* getAvailabeFerrari()
{
return ferrari;
}

#pragma data_seg(".shared")
static car *ferrari = NULL; // pointer to class car
// app doesnt get this part ! why ?
#pragma data_seg("/SECTION:.shared",RWS)

How do i get the app to have access to the instance of the class activated in the dll ?
Or how do i share larger data through a dll .. not simple ints or strings.. these work .. can i use
// have researched MSDN and many books please help
Sep 3 '06 #1
3 4235
Dax
3
I also tried sharing the object itself and not a pointer , but its the same all values turn up as NULL in the APP.
pragma data_seg(".shared")
CCar ferrari();
pragma data...//same stuff goes here.. doesnt work !!

I however have a working version of the APP-DLL data sharing but the issues i get is when the second instance interferes with the first. I need only one instance and instantiated in the dll and have access to that in the app.


any clues guys?
Sep 3 '06 #2
Banfa
9,065 Expert Mod 8TB
You do not need those pragmas, however you do need to use the specifier

__declspec(dllexport)

on the data when importing into the program.

NOTE that you should not use this specifier when declaring the data in the DLL.
Sep 3 '06 #3
Dax
3
ok u mean like this but im tying to use stl objects... in a class ..like so


#define EXP_STL //Compiles with #define EXP_STL for dll

#ifdef EXP_STL
# define DX_API __declspec(dllexport)
# define DX_TEMPLATE
#else
# define DX_API __declspec(dllimport)
# define DX_TEMPLATE extern
#endif

class CPipe
{
public:
vector <CCounter*> CounterObjects; // Main List
vector <CCounter*> CompactList; // to pack similar funcitons
vector <CCounter*> SortedList; // sort based on higher frequency

// stack <CCounter*> slist;


vector <CCounter*>::iterator Counter_iter; // its iterator Not in use !!

size_t available_counters;
size_t total_counters;
ofstream conout;//("con");
HANDLE hConsole;

size_t getAvailableCounters(){return available_counters;}
size_t getMaxStoredCounters(){return total_counters;}

size_t getListSize(){return CounterObjects.size();}
size_t getCompactListSize(){return CompactList.size();}
size_t getSortedListSize(){return SortedList.size();}
// ofstream conout;
Sep 3 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dennis Gavrilov | last post by:
Hi, All! I have two questions: strategic and technical. Technical one first: I need to share an array of objects (implemented as hashes, having references to other objects and hashes, sharing...
6
by: varlagas | last post by:
We disabled the antivirus software but the problem persists. Any clues? Many thanks in advance! Panagiotis Varlagas ======================================================================= ...
1
by: John Baker | last post by:
Hi: I have an application that is getting pretty bloated, and I want to develop new, infrequently used, sections of it ( specifically special report generation) as a separate file from the...
2
by: PeteZ | last post by:
Hi, I was of the understanding that Session variables were GLOBALLY scoped across all Applications on a specific web site and that data obtained and stored in "variables" were available for...
6
by: Yama | last post by:
Hello All I have developed a new site using ASP.NET/VB.NET. I fell into a big problem. Here is the problem I created a module as follow Namespace FinancialCompany.Porta Public Class...
3
by: grooby | last post by:
I would like to develop an asp.net Web application using muliple web projects under one solution file and share the session information between web applications( or projects). Is this possible?
33
by: Jeff | last post by:
I know this is a difficult one to answer, but I am interested in opinions on what hardware upgrades would be recommended with the following. Access 2000 running in a split config, but all in...
8
by: antonyliu2002 | last post by:
We are extending a web application written in classic ASP long time ago. We will add more components to this web application in ASP.NET 2.0. To use the web application, our web users will have...
2
by: thomas | last post by:
Hello All, The question may seem to be trivial, but I found it really was not, and I am hoping that someone who has done it could share his/her experience. How do I share my web application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.