examples/PIPS/handleglobalvar/libwsddll/src/wsddll.cpp

00001 
00005 /*
00006 * ==============================================================================
00007 *  Name        : auth.cpp
00008 *  Part of     : Open C/Example code
00009 *  Description : This is used to handle user authentication and auth database.
00010 *
00011 *  Version     : 1.0
00012 *
00013 *  Copyright (c) 2007 Nokia Corporation.
00014 *  This material, including documentation and any related
00015 *  computer programs, is protected by copyright controlled by
00016 *  Nokia Corporation.
00017 * ==============================================================================
00018 */
00019 
00020 #include <e32cons.h>
00021 #include <e32uid.h>
00022 #include <string.h>
00023 #include "wsddll.h"
00024 #include "pls.h"
00025 
00026 #ifdef __WINSCW__
00027 const TUid KWsdDllUid3 = {0xA000131D};
00028 
00029 // WSD object type for this DLL
00030 struct TWsdData
00031 {
00032         int count;     // Global variable
00033         char name[20]; // Global variable
00034 };
00035 
00036 #else
00037         int count = 0;             // Global variable
00038         char name[20] = "Default"; // Global variable
00039 #endif
00040 
00041 #ifdef __WINSCW__
00042 // Initialisation function for WSD objects - supplied to Pls()
00043 LOCAL_C int InitializeWsd(TWsdData* aArg)
00044 {
00045         aArg->count = 0; // Initialise global count with 0
00046         strcpy(aArg->name,"Default");
00047         return 0;
00048 }
00049 
00050 // Function to fetch the WSD object for this process
00051 LOCAL_C TWsdData* GetGlobals()
00052 {
00053 
00054         // Access the PLS of this process
00055         TWsdData* p = Pls<TWsdData>(KWsdDllUid3, &InitializeWsd);
00056         return p;
00057 }
00058 
00059 #define name (p->name)
00060 #define count (p->count)
00061 
00062 #endif
00063 
00064 EXPORT_C int GetDllInt()
00065 {
00066 #ifdef __WINSCW__
00067         TWsdData* p = GetGlobals();
00068 #endif
00069         return count;
00070 
00071 }
00072 
00073 EXPORT_C void GetDllString(char *str)
00074 {
00075 #ifdef __WINSCW__
00076         TWsdData* p = GetGlobals();
00077 #endif
00078         strcpy(str,name);
00079 
00080 }
00081 
00082 EXPORT_C void SetDllInt(const int i)
00083 {
00084 #ifdef __WINSCW__
00085         TWsdData* p = GetGlobals();
00086 #endif
00087         count = i;
00088 
00089 }
00090 
00091 EXPORT_C void SetDllString(char * str)
00092 {
00093 #ifdef __WINSCW__
00094         TWsdData* p = GetGlobals();
00095 #endif
00096         strcpy(name,str);
00097 
00098 }
00099 
00100 
00101 // end of file

Generated by  doxygen 1.6.2