// Custom DLL example; must be named "mydll"
#define USE_TI89
#include <tigcclib.h>
DLL_INTERFACE
char MessageInDLL[]="Hello!n";
long GlobalVarInDLL;
void HelloFromDLL(void);
int SumFromDLL(int,int);
void Off(void);
DLL_ID 007
DLL_VERSION 2,12
DLL_EXPORTS HelloFromDLL,SumFromDLL,MessageInDLL,&GlobalVarInDLL
DLL_IMPLEMENTATION
void HelloFromDLL(void)
{
printf ("Hello from DLL!n")
printf ("Global variable is %ldn", GlobalVarInDLL);
}
int SumFromDLL(int a, int b)
{
return (a + b);
}
void Off(void)
{
asm("Trap #4")
}
et le fichier pour l'utiliser:
#define USE_TI89
#define SAVE_SCREEN
#include <tigcclib.h>
#define HelloFromDLL _DLL_call(void,(void),0)
#define SumFromDLL _DLL_call_attr(int,(int,int),__attribute__((stkparm)),1)
#define MessageInDLL _DLL_reference(const char,2)
#define GlobalVarInDLL _DLL_glbvar(long,3)
#define Off _DLL_call(void,(void),4)
void _main(void)
{
if (LoadDLL ("xlib", 007, 2, 11) != DLL_OK)
{
DlgMessage ("ERROR", "Error loading DLL!", BT_OK, BT_NONE);
return;
}
clrscr ();
GlobalVarInDLL = 1234567;
HelloFromDLL ();
printf ("Sum from DLL: 2+3=%dn", SumFromDLL (2, 3));
printf ("Message from DLL: %sn", MessageInDLL);
ngetchx ();
Off();
UnloadDLL ();
}
Le fichier etant bien entendu compressé...
Voila ca marche ca charge la dll, mais quand il appelle la fonction off, ca merde (address error, ou alors d'autre prog).
Donc je voulais savoir d'ou venait mon erreur :-(







