Informatii generale
Exemple
Imagini ecran
Comparatii
Aplicatii
Descarca
Documentation
Bazar
Statut si Foaie de parcurs
Intrebari frecvente
Autori si Licenta
Forum
Finantarea Ultimate++
Cauta in acest site
Limbă
română











SourceForge.net Logo

Aceasta pagina nu a fost inca tradusa. Doriti sa o traduceti?

 

Runtime dynamic linking using .dli files

In Ultimate++ you can use .dli file to automatize generating .dll wrapper objects. To create such object you have to provide ".dli" file with content like (actual example is for Lotus Notes client .dll):

 

FN(WORD,   OSLoadString, (HMODULE hModule, STATUS StringCode, char *retBuffer, WORD BufferLength))

FN(WORD,   OSTranslate, (WORD TranslateMode, char far *In, WORD InLength, char far *Out, WORD OutLength))

FN(STATUS, NotesInitExtended, (int argc, char  **argv))

FN(STATUS, OSPathNetConstruct, (char *PortName, char *ServerName, char far *FileName, char *retPathName))

FN(STATUS, NSFDbOpen,  (char far *PathName, DBHANDLE far *rethDB))

FN(STATUS, NSFDbClose,  (DBHANDLE hDB))

...........

 

- basically, this is somewhat "reparsed" header file for .dll. Then place

 

#define DLLFILENAME "nnotes.dll"

#define DLIMODULE   NOTES

#define DLIHEADER   <notes/notes.dli>

#define DLLCALL     LNPUBLIC

#include <Core/dli_header.h>

 

to common header file and

 

#define DLLFILENAME "nnotes.dll"

#define DLIMODULE   NOTES

#define DLIHEADER   <notes/notes.dli>

#define DLLCALL     LNPUBLIC

#include <Core/dli_source.h>

 

to some .cpp file or, if you need that .dll just in single .cpp file, you can use

 

#define DLLFILENAME "nnotes.dll"

#define DLIMODULE   NOTES

#define DLIHEADER   <notes/notes.dli>

#define DLLCALL     LNPUBLIC

#include <Core/dli.h>

 

in .cpp (this is equivalent of placing both above variants to .cpp).

 

This creates global function NOTES() returning the object instance that has all .dll functions described in .dli file defined as its methods. Moreover, it has operator bool that can be used to test whether .dll is present:

 

char h[256];

if(NOTES())

    NOTES().OSLoadString(GetModuleHandle(NULL), ERR(nError), h, 255);

 

 

Aceasta pagina este deasemenea in english. Doriti sa contribuiti?