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 2008

Back to top


All rights reserved. This documentation can be used in the connection with this Product to help and support the user.