How do I know the Funtion Index with Native AddIns

Discuss OrbForms Designer and PocketC Architect

How do I know the Funtion Index with Native AddIns

Postby parissmith on Fri Mar 14, 2008 7:22 pm

Sorry for this really simple question, but when using Native Add Ins, how do I know what the function index is. For example:

int add(int x, int y) @ library("SampleAddIn", 0);
bool hookcontrast(bool hook) @ library("SampleAddIn", 12);
struct SampleSerial {
int id;
void _init() @ library("SampleAddIn", 7);
void _destroy() @ 80;
void _copy(SampleSerial) @ 89;
bool open(int baud) @ library("SampleAddIn", 8 );
void close() @ library("SampleAddIn", 9);
void send(char byte) @ library("SampleAddIn", 10);
char recv() @ library("SampleAddIn", 11);

Where did the 0 come from in the add declaration? And the 12 in hookcontrast?
What about the index numbers in the struct?
I'm just playing around with PocketCArchitect, and getting used to the functionallity, and I'm finding myself with a whole lot of questions.
Thanks for all your input!
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am

Re: How do I know the Funtion Index with Native AddIns

Postby dewey on Tue Jul 08, 2008 7:00 am

These come from the native code which calls the correct native function based on the iFunc parameter as seen in SampleAddIn.cpp:

Code: Select all
void* __Startup__(OrbFormsInterface* ofi, void* data, UInt16 iFunc)
   // we don't need to setup any global state
   if (iFunc == NATIVE_STARTUP) return NULL;
   if (iFunc == NATIVE_SHUTDOWN) return NULL;

   switch (iFunc) {
      case 0: add(ofi); break;
      case 1: TG_onopen(ofi); break;
Site Admin
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests