Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Native Libraries
Page 1 of 1

PostPosted: Thu Aug 23, 2001 6:00 pm
by Dman
Hey, I found a file compression library for the Palm, but it's not specifically for PocketC. Can I use it (with PocketC), or if I can't, how can I make it usable (with PocketC). And How do I make my own PocketC Libraries (I know C++)

http://openpalm.tripod.com

PostPosted: Thu Aug 23, 2001 7:54 pm
by jstadolnik
You'll have to write a native library to interface with the compression library.

First read the PocketC native library documentation. http://www.orbworks.com/PalmOS/docs/native.html

There are two tools sets you can use: Codewarrior ($$$) or gcc/PRC-Tools (free).

If you go with Codewarrior use the PocketClib example which comes with the PocketC desktop distribution.

If you go with gcc/PRC-Tools use the xGrfxLib source as an example. http://one-each.iwarp.com/

You can get the gcc/PRC-Tool chain here:
http://www.palmos.com/dev/tech/tools/

Here is help on setting up the gcc/PRC-Tool chain:
http://www.ardiri.com/index.php?redir=palm&cat=devkit

Here is help on compiling native libs with gcc/PRC-Tools (note the fractal lib example will NOT compile with the OS4.0 SDK):
http://rixon.org/FractalLib/index.html

The following places are excellent sources of general palm development information:
1) The online SDK4.0 documentation (your first line of defense): http://www.palmos.com/dev/tech/docs/palmos/
2) The PalmOS Dev Forum (I find searches here to be especially helpful): http://www.palmos.com/dev/tech/support/forums/
3) The PalmOS knowledge base: http://oasis.palm.com/dev/kb/

Finally, if you need to pass an array of strings to/from a native library function send Jeremy (dewey@orbworks.com) an email and he'll send you a special set of functions for accessing the strings correctly.

Joe

Edited by - jstadolnik on 08/23/2001 15:00:27

PostPosted: Mon Aug 27, 2001 10:02 pm
by Dman

PostPosted: Sat Mar 23, 2002 3:03 am
by jstadolnik
Here is a code sample showing a native library function in which integer and string input values are passed back through pointers.

------

//String structures
enum StrType { stClassic, stIndirect, stConst }; // only used for debugging for now

struct String {
StrType sType;
unsigned int nRef;
char data[1];
};

//This function shows you how to pass integers and strings in as values and
//out through pointers

void ExampleFunc(PocketCLibGlobalsPtr gP) {

Value int_input, int_output_ptr, str_input, str_output_ptr, *intP, *strP;
gP->pop(str_output_ptr);
gP->pop(str_input);
gP->pop(int_output_ptr);
gP->pop(int_input);

String *pString;

//Do integer copy first
intP = gP->deref(int_output_ptr.iVal); //get pointer to int_output
intP->iVal = int_input.iVal; //Copy int_input to int_output

//Do string copy next
char *newdata = (char*)MemHandleLock(str_input.sVal); //get value of input string
gP->retVal->iVal = StrLen(newdata); //set return value to be size of input string
strP = gP->deref(str_output_ptr.iVal); //get pointer to str_output

//Check if string sVal is a MemPtr or a MemHandle
if (0x80000000 & (UInt32)strP->sVal) {
//It's a MemHandle : need to resize the old handle
MemHandleResize(strP->sVal,sizeof(String)+StrLen(newdata)); //change handle size
pString = (String*)MemHandleLock(strP->sVal); //lock handle
}
else {
//It's a MemPtr : need to allocate a new handle
strP->sVal = MemHandleNew(sizeof(String)+StrLen(newdata)); //change handle size
pString = (String*)MemHandleLock(strP->sVal); //lock handle
pString->sType = stIndirect; //set type of string (currently unused)
pString->nRef = 1; //for string garbage collection
}

//Copy the string data from str_input to str_output
StrCopy(&pString->data[0],newdata);
MemHandleUnlock(strP->sVal); //unlock handle

//unlock str_input
//note: don't need to unlock str_input.sVal if you clean it
gP->cleanup(str_input);
}



The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm