Luc Le Blanc wrote:
Where can I find sample code for an exchange (shared) library?
Very hard to get hold of. Never managed it. Somewhere on the Palm
Knowladge base is a project with an app containing a exchange library.
I intend to write a serial exchange library and make it
publicly available (even though I suspect this is not the
most sought after piece of free Palm OS software.)
Just having an example for people to look at may make doing this in the
futre easier :)
By the way, this library should work either in pure serial
mode, or with modems connected back to back. In this latter
case, some AT strings shall have to be sent. Where should
they be configured? As strings send to ExgPut, in the
PalmModem network connection (how do I fetch this?) or in the
calling app?
I would put thinks like this in the ExgControl function[*1].
Luc Le Blanc
I have managed to write a shared library to act as an exchange library
for our mail applications. Objects send via it are sent as attachments.
Start by createing a normal shared library.
Set the library type to be sysFileTExgLib
The first 4 functions will be the standard Open/Close/Sleep/Wake routines.
The next 10 are the Exchange Library functions. Look in ExgLib.h (?) to
see theire prototypes. You can name them anything you like, but the
SysTrap numbers & paramiters must match.
Add any custom functions after this. We have an Activet/Deactivate
function to enable/disable the exchange library.[*2]
Fill in code for which ever exchange functions you need. We used
ExgLibPut/ExgLibSend to receieve data to put into an attachment.
Note:
ALL system resources (Memory, open DB handles) must be assigned to the
system, or after the first app switch things will go bad very quickly..
Something must load the library after a reset/hotsync. The system will
not do this for you. Our mail app checks for out exchange library and if
found, calls open/activate/close[*3] to enable it.
It is a good idea to disable the libray during hotsync, or else you will
not be able to replace it with a new version. You can register for the
hotsinc start/end notifications to achive this.
[1]
We use the ExgControl to handle setting things like the To/CC/BCC fields
of the resultant e-mail. ExgControls paramiters are a UInt16 OpCode,
void* to Data and a UInt16 DataLen.
[2]
To Activate our library opens itself, to lock itself into memory, and
calls ExgRegisterDatatype to register for the "_send" scheme and our own
custom scheme. Decativate unregisters and closes the library.
[3]
Because the activate call calls open itself, we end up with the library
being opend twice. So when the app closes it we are still left open, and
all code segments are still locked.
--
For information on using the ACCESS Developer Forums, or to unsubscribe, please
see http://www.access-company.com/developers/forums/