Some small suggestions

Feb 15, 2010 at 2:33 PM

First, thank you very much for your excellent library. We are using it to compress 16-bit grayscale data in a Delphi application that manipulates Infrared images and it works extremely well!

Here a two small suggestions:

1) The calling convention for the exported "C" API does not specify calling convention and is defaulting to __cdecl as configured in the VS project files. It might be better to define the calling convention directly on the exported functions so the calling convention is explicitly set (see Exporting from a DLL Using __declspec(dllexport)). Also, a calling convention of __stdcall is more cross-language friendly and consistent with the Windows API calling convention.

2) There is a minor spelling error in two identifiers:  "JfifParamaters" -> "JfifParameters" and "JlsParamaters" "-> JlsParameters"

Thanks,

David

http://www.xperttool.com

 

Coordinator
Feb 17, 2010 at 9:03 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Feb 17, 2010 at 9:20 PM

As you see I made it a workitem. For non-C users stdcall is probably more convenient, I'' follow up on that.

Feb 25, 2010 at 2:18 PM

Thanks for looking into this issue. I have taken a look at the revised code and found that the calling convention is now correct, but there is an issue with name mangling/decoration since the functions are exported from a .CPP file. This appears to be a feature (limitation?) of VC++ that exists to support overloading of exported functions for C++ applications. Here is what I am seeing in the exports table of the generated DLL:

_JpegLsDecode@20
_JpegLsEncode@24
_JpegLsReadHeader@12
_JpegLsVerifyEncode@16

After some extensive Google research and experimentation I concluded that the only means of fixing the naming issue short of moving to a .C file is to use a .DEF file for the exports. The following DEF file does the trick and can be installed by adding the file under Properties->Linker->Input->Module Definition File. This setting should be set to "charls.def" assuming that is the name of the DEF file and that it is in placed alongside the other source files:

charls.def

LIBRARY charls
EXPORTS
JpegLsEncode
JpegLsDecode
JpegLsReadHeader
JpegLsVerifyEncode

Very annoying behavior on the part of VC++ since this is not an uncommon requirement.

Thanks,

David

 

 

 

Coordinator
Feb 28, 2010 at 3:37 PM

Thanks for all the legwork! I agree that the undecorated names are preferred. I'll include a DEF file.