I have figured it out (mostly).
I need to assembly the .s file first
Code:
arm-linux-gcc.exe -c libgp2x_asm.s
this creates the .o file.
I then have my unit I translated from the header file:
Code:
Unit libgp2x;
{$link libgp2x_asm.o}
{$linklib c}
Interface
Uses
CTypes;
Function OpenFile(pszFile: PChar; nMode: ctypes.cint32): Integer; External;
Procedure CloseFile(nFile: ctypes.cint32); External;
Function MMap(pAddr: Pointer; nLen,nProtection,nFlags,nFD,nOff: ctypes.cint32): Pointer; External;
Procedure MUnmap(p: Pointer; nSize: ctypes.cint32); External;
Procedure ChangeDir(pszDir: PChar); External;
Procedure ExecuteFile(pszFile: PChar; nZero1,nZero2: ctypes.cint32); External;
Procedure RestartMenu;
{
extern int OpenFile(char *pszFile, int nMode);
extern void CloseFile(int nFile);
extern void *MMap(void *pAddr, int nLen, int nProtection, int nFlags, int nFD, int nOff);
extern void MUnmap(void *p, int nSize);
extern void ChangeDir(char *pszDir);
extern void ExecuteFile(char *pszFile, int nZero1, int nZero2);
extern void RestartMenu();
}
Implementation
Procedure RestartMenu;
Begin
ChangeDir (PChar('/usr/gp2x'));
ExecuteFile(PChar('/usr/gp2x/gp2xmenu'), 0, 0);
End;
{..............................................................................}
{..............................................................................}
End.
The problem I now have is when I try and link in my libgp2x unit I get this error:
Code:
Assembling engine3dtest
Linking engine3dtest
libgp2x.o: In function `LIBGP2X_RESTARTMENU':
libgp2x.pas:(.text+0x14): undefined reference to `LIBGP2X_CHANGEDIR$PCHAR'
libgp2x.pas:(.text+0x24): undefined reference to `LIBGP2X_EXECUTEFILE$PCHAR$LONG
INT$LONGINT'
An error occured while linking engine3dtest
Press any key to continue . . .
For some reason the linker doesn't like my references in the RestartMenu procedure to the ChangeDir and ExecuteFile external routines...
Any ideas?
cheers,
Paul.
Bookmarks