Welcome! Log In Create A New Profile

Advanced

adding a c++ code in WD Mobile

Posted by Mitchell 
Mitchell
adding a c++ code in WD Mobile
February 10, 2009 01:35PM
Dear WD mobile coders,
does anyone here has an experience on adding the C++ commands inside WD Mobile?

for example, I am having a c++ file called "PrinterDemo.CPP" , how to use this file inside WD Mobile ?

for dotnet , it is very easy to import as dotnet assemblies, but for c++ i have zero idea :-(


help please
mikz
Fabrice Harari
Re: adding a c++ code in WD Mobile
February 10, 2009 02:18PM
Hi Mitchell

You'll have to create a dll with the C code, then call the dll from wm

Best regards

BLS
Re: adding a c++ code in WD Mobile
February 13, 2009 07:56PM
HI Mitchell,
just to give you an idea how such a DLL could look like.

(you have to modify your PrinterDemo.CPP a little and export the C++ function like shown in this little sample)

// testdll.h

#ifdef TESTDLL_EXPORTS
#define WDEXPORT extern "C" __declspec(dllexport)
#else
#define WDEXPORT  extern "C" __declspec(dllimport)
#endif


WDEXPORT int fntestdll(void);
WDEXPORT void fninc(int* intptr);

and it's implemetation

// testdll.cpp : Defines the entry point for the DLL application.

#include "stdafx.h"
#include "testdll.h"


BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
    return TRUE;
}


// This is an example of an exported function.
WDEXPORT int fntestdll(void)
{
	return 42; // what else smiling smiley
}
WDEXPORT void fninc(int* intptr)
{
	++*intptr;
}

HTH, Bjoern
Mitchell
Re: adding a c++ code in WD Mobile
February 14, 2009 04:28PM
thanks BJoern,
I have to try this option.

I hope i will be succeed...


thanks
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: