S60 Open C
Examples for Open C Libraries

Examples for Open C Libraries

Table of Contents

Handle Global Variable
MMP File for Handle Global Variable
Source Code for Handle Global Variable

 


Handle Global Variable

This example shows how to handle a global variable within the library code and provides a solution to the WSD problem.

 


MMP File for Handle Global Variable

The MMP file for Handle Global Var is as shown below:

TARGET        	globalvarex.exe
TARGETTYPE    	exe
UID           		0 0xA000131E
CAPABILITY      	NONE
VENDORID        	0
SOURCEPATH      .	.\data
START RESOURCE  globalvarex_reg.rss

#ifdef WINSCW
TARGETPATH 	    \private\10003a3f\apps
#else
TARGETPATH 	    \private\10003a3f\import\apps
#endif
END //RESOURCE

SOURCEPATH    ..\src
SOURCE        globalvarex.c
USERINCLUDE   ..\inc
USERINCLUDE   ..\libwsddll\inc

SYSTEMINCLUDE \epoc32\include
SYSTEMINCLUDE \epoc32\include\stdapis

STATICLIBRARY libcrt0.lib
LIBRARY		libc.lib
LIBRARY		libpthread.lib
LIBRARY		libwsddll.lib
LIBRARY		euser.lib

 


Source Code for Handle Global Variable

The code snippet shows how to handle a global variable from within the library and also, provides a solution to the WSD problem.

//systeminclude
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<error.h>
#include "wsddll.h"
//#include<staticlibinit_gcce.h>

int main(void)
{
	char str[20];

	printf ("DLL global int value : %d\n",GetDllInt());
	GetDllString(str);
	printf ("DLL global String value : %s\n",str);

	SetDllInt(1008);
	SetDllString("HelloWorld");

	printf ("DLL global int value : %d\n",GetDllInt());
	GetDllString(str);
	printf ("DLL global String value : %s\n",str);

  printf("Press any key to exit.\n");
  getchar();
  return 0;
}

NOTE: This code has been tested on Carbide.

Give feedback of this article


ŠNokia 2007

Back to top


This material, including documentation and any related computer programs, is protected by copyright controlled by Nokia. All rights are reserved. Copying, including reproducing, storing, adapting or translating, any or all of this material requires the prior written consent of Nokia. This material also contains confidential information, which may not be disclosed to others without the prior written consent of Nokia.

Nokia is a registered trademark of Nokia Corporation. S60 and logo is a trademark of Nokia Corporation. Other company and product names mentioned herein may be trademarks or tradenames of their respective owners.