Navigation  without Java Scripts

Using Visual Prolog DLLs from Microsoft Visual C++

The directory \Foreign\Examples\Msvc contains examples of how to use a Dynamic Link Library (DLL) created with Visual Prolog in Microsoft Visual C++ (see Using Visual Prolog DLLs from other languages for an overview of the examples)

All these examples use the same Visual Prolog DLLs that are found in the DLLS directory, so these have to be compiled before any of the examples are compiled and run.

Notes for C++

Please also read the common notes.

<__stdcall> modifier should be set for description of imported function in C/C++ code.
input arguments have type according to type in Visual Prolog:
Visual Prolog C/C++
integer int
real double
unsigned unsigned
string char*

 

output arguments are pointers to appropriate type:
Visual Prolog C/C++
integer int*
real double*
unsigned unsigned*
string char**

 

directive <extern "C"> should be used in C++ case:

#ifdef __cplusplus
extern "C" {
#endif
/*list of imported functions from DLL*/
void APIENTRY dll_mark_gstack(unsigned long *out);
void APIENTRY dll_release_gstack(unsigned long in);
void APIENTRY setInteger(int In );
void APIENTRY getInteger(int* Out);
void APIENTRY setReal(double In );
void APIENTRY getReal(double* Out );
void APIENTRY setString(char* In);
void APIENTRY getString(char** Out);
#ifdef __cplusplus
}
#endif

Examples

NONGUI: Visual Prolog project with MSVC as the main program, which uses non-GUI Visual Prolog DLL.

USEVPI: Microsoft Visual C++ MFC project, which uses a Visual Prolog DLL with VPI.

ActiveX: Microsoft Visual C++ MFC ActiveX project, which uses a Visual Prolog DLL with VPI.