Some questions about making a library

Discuss PocketC for Palm OS (including Desktop Edition)

Postby izzy on Tue Mar 08, 2005 6:44 pm

I've gotten bored with PocketC and started to learn C proper. The fist thing I made, of course, is a PocketC library. A couple of questions.

1) How do you declare a pointer argument in a library function?

I,ve declared it as a vtInt and then

long *lPtr;
lPtr = (*long)myInt.iVal;

Is this right?

2)Everything compiled correctly in CodeWarrior 9.0, but when I tried to compile a program using the library on my palm, it gave me the message ' MyFunc definition not found'. When I tried to compile it on the Emulator, it compiled correctly, but got an address error.I must have some setting or path messed up in CodeWarrior.

Can anyone help me?
Posts: 20
Joined: Fri Jun 11, 2004 1:48 pm

Postby izzy on Wed Mar 09, 2005 6:15 pm

Hello! Anyone out there? Please?
Posts: 20
Joined: Fri Jun 11, 2004 1:48 pm

Postby mgreen on Thu Mar 10, 2005 12:28 am

Look at the Native Libraries global function deref(int ptr). It converts a Pocket C pointer into a "real" PalmOS pointer which you can then use to reference the value you want.

Michael Green
Michael Green
Posts: 72
Joined: Fri Mar 14, 2003 9:40 pm
Location: USA

Postby izzy on Fri Mar 11, 2005 1:41 pm

Thanks, Anyone for Question 2?
Posts: 20
Joined: Fri Jun 11, 2004 1:48 pm

Postby dewey on Sun Mar 13, 2005 10:56 pm

Problem 1 would have caused the crash in problem two. If the function is not found when compiling on the device, you should check that your PocketCLibAddFunctions function is implemented correctly.
Site Admin
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests