TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Inability to compile with twain.h in Visual Studio 2013

Forums › TWAIN Classic › Inability to compile with twain.h in Visual Studio 2013

  • This topic has 1 reply, 2 voices, and was last updated 5 years, 9 months ago by MarkM.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • April 13, 2015 at 3:07 pm #23005 Reply
    TwainMaestro
    Participant
    • Topics - 2
    • Replies - 0
    • Total Posts - 2

    My project type in Visual Studio Premium 2013 is a C++ Library

    These lines of code in twain.h generate this: Error: Function returning function is not allowed

    TW_HANDLE TW_CALLINGSTYLE DSM_MemAllocate(TW_UINT32);
    typedef TW_HANDLE(TW_CALLINGSTYLE *DSM_MEMALLOCATE)(TW_UINT32 _size);

    Can anyone tell me how to resolve this?

    April 28, 2015 at 4:00 pm #26267 Reply
    MarkM
    Participant
    • Topics - 1
    • Replies - 135
    • Total Posts - 136

    I downloaded the TWAIN Data Source Manager (DSM) from http://sourceforge.net/projects/twain-dsm/files/TWAIN%20DSM%202%20Source/ and converted the VS2010 solution to VS2013, and (after making a code tweak unrelated to TWAIN.H) I successfully built the DSM.

    That suggests that TWAIN.H is okay, which suggests that there’s a conflict with some other part of the environment it’s being built within. For instance, if some include file redefine some macro, that could cause a problem.

    If you turn on full output from the VS compiler, it ought to give you enough information to find the problem. The only macro that I can see being a candidate for a problem is PASCAL which is used to define TW_CALLINGSTYLE, and resolved to __stdcall. You might trying doing an #undef PASCAL before #include to see if that lets the code compile, but by itself that won’t qualify as a fix, it’ll just help you identify the problem.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Inability to compile with twain.h in Visual Studio 2013
Your information:




Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.