NO

Author Topic: GetDefaultPrinterA missing from libs  (Read 95 times)

Offline rko

  • Member
  • *
  • Posts: 9
GetDefaultPrinterA missing from libs
« on: July 12, 2018, 06:26:54 pm »
I:\openbgi\library\graphics.c(354): warning #2018: Undeclared function 'strcpy_s' (did you mean: strcpy?); assuming 'extern' returning 'int'.
I:\openbgi\library\graphics.c(1628): warning #2115: Local 'dataOffset' is initialized but never used.
I:\openbgi\library\graphics.c(1627): warning #2115: Local 'fileSize' is initialized but never used.
I:\openbgi\library\graphics.c(91): warning #2135: Static 'bitarray' is not referenced.
Erzeugen von I:\openbgi\library\bgi\bgi.dll.
POLINK: error: Unresolved external symbol 'GetDefaultPrinterA' - referenced from 'I:\openbgi\library\bgi\output\graphics.obj'.
POLINK: fatal error: 1 unresolved external(s).

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 1720
Re: GetDefaultPrinterA missing from libs
« Reply #1 on: July 12, 2018, 06:51:32 pm »
I:\openbgi\library\graphics.c(354): warning #2018: Undeclared function 'strcpy_s' (did you mean: strcpy?); assuming 'extern' returning 'int'.
define __STDC_WANT_LIB_EXT1__=1
POLINK: error: Unresolved external symbol 'GetDefaultPrinterA' - referenced from 'I:\openbgi\library\bgi\output\graphics.obj'.
did you include winspool.lib
« Last Edit: July 12, 2018, 06:59:21 pm by TimoVJL »
May the source be with you

Offline rko

  • Member
  • *
  • Posts: 9
Re: GetDefaultPrinterA missing from libs
« Reply #2 on: July 12, 2018, 07:58:53 pm »
did you include winspool.lib

yes


define __STDC_WANT_LIB_EXT1__=1
thanks for that, didn't know


Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 1947
    • http://www.smorgasbordet.com
Re: GetDefaultPrinterA missing from libs
« Reply #3 on: July 15, 2018, 01:15:15 pm »
GetDefaultPrinterA/W() is included in winspool.lib, but with the same attributes as in M$ import libs. For some reason the import is by ordinal, although it looks like the export is by name (GetProcAddress by name works). No idea why. Using M$ tools and SDK gives the same linker error.

Use GetProcAddress(..., "GetDefaultPrinterA") or build your own import lib for winspool.
/Pelle