5,600,335 Members 34,326 Now Online
XDA Developers Android and Mobile Development Forum

RIL ERROR: LNK2019

Tip us?
 
ballrock2
Old
#1  
Junior Member - OP
Thanks Meter 0
Posts: 24
Join Date: Jul 2003
Default RIL ERROR: LNK2019

Hi,

I tried so compile the RIL-Sample in my vEmbeddedC++.
The Workspace is the original from this website, no modifications.
Every time i try to compile and send to my MDA i get the following error:

Quote:
Linking...
tstril.obj : error LNK2019: unresolved external symbol RIL_Initialize referenced in function "unsigned long __cdecl DoRIL(void *)" (?DoRIL@@YAKPAX@Z)
ARMRel/tstril.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

tstril.exe - 2 error(s), 0 warning(s)
If I try other own projects, there is no problem to send and start to/on MDA. The compiled ARM-Release also works.

Would be great, if anyone of you has got a tip, where's my fault.

Greetings from hannovre,
Andreas
 
itsme
Old
#2  
Retired Admin
Thanks Meter 5
Posts: 652
Join Date: Mar 2003
Location: delft 52'00N 4'22E
that is because there is no ril.lib, you will either have to create it your self,
or use another method to get pointers to the ril.dll.
I usually use something like this:
-------rillib.h
Code:
typedef HRESULT (*PFRIL_Initialize)(DWORD dwIndex, RILRESULTCALLBACK pfnResult, RILNOTIFYCALLBACK pfnNotify, 
									DWORD dwNotificationClasses, DWORD dwParam, HANDLE *phRil);
typedef HRESULT (*PFRIL_DeInitialize)(HANDLE hRil);
typedef HRESULT (*PFRIL_GetRegistrationStatus)(HANDLE hRil);
typedef HRESULT (*PFRIL_GetCellTowerInfo)(HANDLE hRil);
typedef HRESULT (*PFRIL_DevSpecific)(HANDLE hRil, BYTE*params, DWORD dwSize);

extern PFRIL_Initialize RIL_Initialize;
extern PFRIL_GetRegistrationStatus RIL_GetRegistrationStatus;
extern PFRIL_GetCellTowerInfo RIL_GetCellTowerInfo;
extern PFRIL_DevSpecific RIL_DevSpecific;
---------rillib.c
Code:
#include "rillib.h"

PFRIL_Initialize RIL_Initialize;
PFRIL_GetRegistrationStatus RIL_GetRegistrationStatus;
PFRIL_GetCellTowerInfo RIL_GetCellTowerInfo;
PFRIL_DevSpecific RIL_DevSpecific;
class RilLib {
public:
	RilLib()
	{
		m_hRilDll= LoadLibrary(L"ril.dll");

		RIL_Initialize= (PFRIL_Initialize)GetProcAddress(m_hRilDll, L"RIL_Initialize");
		RIL_GetRegistrationStatus= (PFRIL_GetRegistrationStatus)GetProcAddress(m_hRilDll, L"RIL_GetRegistrationStatus");
		RIL_GetCellTowerInfo= (PFRIL_GetCellTowerInfo)GetProcAddress(m_hRilDll, L"RIL_GetCellTowerInfo");
		RIL_DevSpecific= (PFRIL_DevSpecific)GetProcAddress(m_hRilDll, L"RIL_DevSpecific");
	}

	~RilLib()
	{
		RIL_Initialize= NULL;
		RIL_GetRegistrationStatus= NULL;
		RIL_GetCellTowerInfo= NULL;
		RIL_DevSpecific= NULL;
		FreeLibrary(m_hRilDll);
	}
private:
	HMODULE m_hRilDll;

};
static RilLib g_rillib;
 
W4XY
Old
#3  
Senior Member
Thanks Meter 1
Posts: 137
Join Date: Jan 2003
Location: Earth... I think
Quote:
Originally Posted by XDA developer Itsme
that is because there is no ril.lib, you will either have to create it your self,
or use another method to get pointers to the ril.dll.
The ril.lib is in the tstril directory. you need to include it in the project. The Readme.txt describes how to create a ril.lib from any ril.dll
W4XY
 
ballrock2
Old
#4  
Junior Member - OP
Thanks Meter 0
Posts: 24
Join Date: Jul 2003
Many thanks, I've included the RIL and now it seems to work.

A short question to the ExampleProgramm is left: In which format ist the SMS-Message? Hex? Exists a routine to decode the SMS to readable text?

Greetings,.
Andreas :o)
 
mjgermain
Old
#5  
Junior Member
Thanks Meter 0
Posts: 18
Join Date: Jan 2003
Location: Huddersfield UK
Hi ballrock2

This code will decipher the incoming byte stream. It's not particularly elegant but it seems to work, (I've not included error checking etc)

Code:
unsigned char byteflip(unsigned char inchar)
{
	unsigned char outchar;
	unsigned char tmp;
	int i;

	outchar = 0;
	for (i = 0; i < 8; i++)
	{
		tmp = inchar & 1;		// get lsb in tmp
		inchar >>= 1;			// shift right
		outchar = (outchar << 1)  | tmp;	
	}
	return outchar;
}



TCHAR *msgdecipher(unsigned char *data, int n)
{
	unsigned char ybuf[1000];	// buffer of byteflipped data
	unsigned char tmp;			// temporary character
    static TCHAR xbuf[1000];	// output unicode buffer
	int i;						// index into inconimg and output character stream
	int j;						// index into flipped bytestream
	int k;						// counter for each bit in 7 bit character
	int l;						// counter to know when to increment j
	int escape;					// set true when esc (1b) encountered in output stream

    TCHAR *p;					// pointer to output buffer
    
	
	p=xbuf;


	// byteflip each input char and store in ybuf

	for (i = 0; i < n; i++)
	{
		ybuf[i] = byteflip(data[i]);
	}

	
	// read each 7 bits from ybuf, create a character and re-flip

	j = 0;
	k = 0;
	l = 0;
	
	escape = 0;

	for (i = 0; i < n; i++)		// loop for each output character
	{
		tmp = 0;
		for (k = 0; k < 7; k++)
		{
			tmp <<= 1;
			if (ybuf[j] & 128)
			{
				tmp |= 1;;
			}
			ybuf[j] <<= 1;
			l++;
			if (l == 8)			// when 8 bits read, go onto next char in bytestream
			{
				j++;
				l = 0;
			}
		}

		// shift left, so that when re-flipped, msb is zero

		tmp = byteflip(tmp<<1);


		// handle special and accented characters

		// normal ascii drops straight through


		if (tmp == 27)
		{
			escape = 1;		// set flag and get next character
		}
		else
		{
			if (escape)
			{
				escape = 0;
				switch (tmp)
				{
				case 20:
					tmp = '^';
					break;
				case 40:
					tmp = '{';
					break;
				case 41:
					tmp = '}';
					break;
				case 47:
					tmp = '\\';
					break;
				case 60:
					tmp = '[';
					break;
				case 61:
					tmp = '~';
					break;
				case 62:
					tmp = ']';
					break;
				case 64:
					tmp = '|';
					break;
				}
			}
			else
			{

				switch (tmp)
				{
				case 0:
					tmp = '@';
					break;
				case 1:
					tmp = '';
					break;
				case 2:
					tmp = '$';
					break;
				case 3:
					tmp = '';
					break;
				case 4:
					tmp = '';
					break;
				case 5:
					tmp = '';
					break;
				case 6:
					tmp = '';
					break;
				case 7:
					tmp = '';
					break;
				case 8:
					tmp = '';
					break;
				case 9:
					tmp = '';
					break;
				case 11:
					tmp = '';
					break;
				case 12:
					tmp = '';
					break;
				case 14:
					tmp = '';
					break;
				case 15:
					tmp = '';
					break;
				case 17:
					tmp = '_';
					break;
				case 28:
					tmp = '';
					break;
				case 29:
					tmp = '';
					break;
				case 30:
					tmp = '';
					break;
				case 31:
					tmp = '';
					break;
				case 64:
					tmp = '';
					break;
				case 91:
					tmp = '';
					break;
				case 92:
					tmp = '';
					break;
				case 93:
					tmp = '';
					break;
				case 94:
					tmp = '';
					break;
				case 95:
					tmp = '';
					break;
				case 96:
					tmp = '';
					break;
				case 123:
					tmp = '';
					break;
				case 124:
					tmp = '';
					break;
				case 125:
					tmp = '';
					break;
				case 126:
					tmp = '';
					break;
				case 127:
					tmp = '';
					break;
				}

			}
			
			p += _sntprintf(p, 2, TEXT("%c"),tmp);
			

		}



	}




    return xbuf;
}
Regards

Malcolm Germain
 
ballrock2
Old
#6  
Junior Member - OP
Thanks Meter 0
Posts: 24
Join Date: Jul 2003
Many many thanks!!! :o)

It works! ;o) If someone would like to get the project (Receiving SMS in "readbable" format), pse mail me.

I'm now searching for a way to send SMS ;o)
 
mjgermain
Old
#7  
Junior Member
Thanks Meter 0
Posts: 18
Join Date: Jan 2003
Location: Huddersfield UK
Sending is even easier

Look at SmsOpen SmsSendMessage and SmsClose in the documentation



Code:
#include <sms.h>

long fnSendSMS(LPCTSTR inaddr,LPCTSTR inmsg)
{
HRESULT res, res2;
LPCTSTR  ptsMessageProtocol;
SMS_HANDLE  psmshHandle;
SMS_ADDRESS  psmsaDestinationAddress;
TEXT_PROVIDER_SPECIFIC_DATA tpsd;
SMS_MESSAGE_ID msgid;


    ptsMessageProtocol = _T("Microsoft Text SMS Protocol");
	res = SmsOpen(ptsMessageProtocol,SMS_MODE_SEND, &psmshHandle,NULL);

		psmsaDestinationAddress.smsatAddressType = SMSAT_INTERNATIONAL;
		wcscpy(psmsaDestinationAddress.ptsAddress ,inaddr);
		tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE;
		tpsd.psMessageClass = PS_MESSAGE_CLASS1;
		tpsd.psReplaceOption = PSRO_NONE;

	res = SmsSendMessage(
		 psmshHandle,
		 NULL,
		 &psmsaDestinationAddress,
		 NULL,
		 (BYTE *)inmsg,
		 wcslen(inmsg) * 2,
		 (unsigned char *)&tpsd,
		 sizeof(tpsd),
		 SMSDE_OPTIMAL,
		 SMS_OPTION_DELIVERY_NONE,
		 &msgid);

	
	res2 = SmsClose(psmshHandle);
	return long(res);
}
Regards

Malcolm Germain
 
Jeronimo
Old
#8  
Junior Member
Thanks Meter 0
Posts: 4
Join Date: Jul 2003
Is there a way to send PDU data instead of TEXT data.

I would like to send EMS messages (text + picture) using RIL.

EMS is like SMS but with specific data header (TP-UDH) and content (TP-UD).

I need to send a complete PDU packet (as with AT+CMGF=0 when using a GSM modem).

For ptsMessageProtocol what are all supported values ?

That could be possible, because EzWap 2.5 is able to send MMS messages with XDA (need to send PDU data by SMS too).

Any idea ?

Thanks,
Jeronimo

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


XDA PORTAL POSTS

Intelligently Place Contacts on Your Home Screen with CallWho Widget

There are plenty of ways to get your contacts to show up on your … more

Control TWRP from within Android with TWRP Coordinator

You may recall that back when TWRP2 introduced a couple of years ago, it brought with … more

Keep Track of Everything Your Device Does with Event Logger

Regardless of their OS choice, computing power users generally share one common … more

A More Competitive Spin on the Addictive 2048 Puzzle

You may recall that a few weeks ago, we talked about a rather interesting take on … more