Externals Under 2.7.x
Dave
dave at looktowindward.com
Fri Feb 9 07:24:44 EST 2007
Hi All,
I am trying to make an External work under 2.7.4.291. I downloaded
and used the "External Creator V1.rev" from the
"ExternalsEnvironmentV2" article. At the moment I just have one
simple function that just passes back a value to the calling stack.
However I get an execution error when I run the Script. I've check
that "the externals" is set correctly and the XCode project builds ok
and I get an X86-32 bundle file ok.
I am using a Mac Pro and Runner Mac OS X Tiger 10.4.8. I only need to
produce an external for Intel based Macs at the moment.
Does anyone know if there's some kind of magic I have to perform to
make this work? If anyone has a sample Intel/Mac External they have
build that I could test to see if it works that would be great. Or if
someone could send me a sample XCode project that would be good too!
A couple of specific questions:
1. Does the name in the EXTERNAL_BEGIN_DECLARATIONS need to be all
lowercase?
2. Does the name in the EXTERNAL_DECLARE_FUNCTION need to be all
lowercase?
I have appended the C Code from the XCode project at the end of this
message.
Thanks in Advance for any help,
All the Best
Dave
//
************************************************************************
**********************
//**
//** Revolution external definition file for 'TestFPA2'
//**
//
************************************************************************
**********************
#include <revolution/external.h>
#include "fpacore2.h"
//**
//** User Definitions
//**
void crsFPAGetVersion( char* theArgumentArrayPtr[],
int theArgumentCount,
char** theResultPtrPtr,
Bool* thePassFlagPtr,
Bool* theErrorFlagPtr);
//**
//** External Declarations
//**
//EXTERNAL_BEGIN_DECLARATIONS("TestFPA2")
EXTERNAL_BEGIN_DECLARATIONS("testfpa2")
//EXTERNAL_DECLARE_FUNCTION("crsFPAGetVersion",crsFPAGetVersion)
EXTERNAL_DECLARE_FUNCTION("crsfpagetversion",crsFPAGetVersion)
EXTERNAL_END_DECLARATIONS
//
************************************************************************
**********************
//**
//** crsFPAGetVersion
//**
//
************************************************************************
**********************
void crsFPAGetVersion( char* theArgumentArrayPtr[],
int theArgumentCount,
char** theResultPtrPtr,
Bool* thePassFlagPtr,
Bool* theErrorFlagPtr)
{
TFPAui32 myFPAVersionNumber;
char myVersionStringBuffer[32];
long myVersionStringSize;
char* myVersionStringBufferPtr;
//**
//** Check the Number of Arguments
//**
if(theArgumentCount != 0)
{
*theResultPtrPtr = strdup("crsFPAGetVersion - Incorrect Argument
Count");
*theErrorFlagPtr = True;
*thePassFlagPtr = False;
return;
}
//**
//** Get the Version Number
//**
myFPAVersionNumber = fpaCoreGetVersion();
sprintf(&myVersionStringBuffer[0],"%s",myFPAVersionNumber);
//**
//** Allocate a Buffer for the String
//**
myVersionStringSize = strlen(&myVersionStringBuffer[0]) + 1;
myVersionStringBufferPtr = (char*)malloc(myVersionStringSize);
if(myVersionStringBufferPtr == NULL)
{
*theResultPtrPtr = strdup("crsFPAGetVersion - Memory Allocation
Error");
*theErrorFlagPtr = True;
*thePassFlagPtr = False;
return;
}
//**
//** Copy the Version String into the Allocated Buffer
//**
strcpy(*theResultPtrPtr,myVersionStringBufferPtr);
*theErrorFlagPtr = False;
*thePassFlagPtr = False;
return;
}
More information about the use-livecode
mailing list