Home › Forums › TWAIN Classic › Inability to compile with twain.h in Visual Studio 2013
- This topic has 1 reply, 2 voices, and was last updated 8 years, 11 months ago by MarkM.
- AuthorPosts
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?
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. - AuthorPosts