Vue d'ensemble
Exemples
Captures d'écrans
Comparaisons
Applications
Télécharger
Documentation
Bazaar
État et Feuille de route
Foire aux questions
Auteurs & licence
Forums
Financement de U++
Recherche sur ce site
Langue
français











SourceForge.net Logo



Cette page n'a pas encore été traduite. Voulez-vous traduire cela ?

 

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);

 

 

Cette page est aussi en english. Vous voulez nous aider ?