Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 1888

Accessing external variable exported by DLL

$
0
0

I am trying to make a Delphi wrapper for the PDCurses (Public Domain Curses) DLL.
This DLL exports several variables.

Example from C(++) header:

#ifdef PDC_DLL_BUILD
# ifdef CURSES_LIBRARY
#  define PDCEX __declspec(dllexport) extern
# else
#  define PDCEX __declspec(dllimport)
# endif
#else
# define PDCEX extern
#endif

PDCEX  int          LINES;        /* terminal height */
PDCEX  int          COLS;         /* terminal width */
PDCEX  int          COLORS;
PDCEX  int          COLOR_PAIRS;

I am trying to access these variables from Delphi now and this seems to fail.
Using FPC one would do the following:

var
  LINES: Integer external LIBPDCURSES name 'LINES';
  COLS: Integer external LIBPDCURSES name 'COLS';
  COLORS: Integer external LIBPDCURSES name 'COLORS';
  COLOR_PAIRS: Integer external LIBPDCURSES name 'COLOR_PAIRS';

Is there a way to do the same with Delphi?
Using XE10.2 Starter I get an error stating this is a no-go.

If no: RFC? I would love to be able to create nice CLI UIs using PDCurses (As it's multi-platform and 16 & 32 & 64 bit compatible). :)


Viewing all articles
Browse latest Browse all 1888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>