[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

R: Problem building an application over SFL



Thank's to Bob and Jonathan!!!

You rightly pointed the two problems existing within my VC++ project

1) Dllimport vs. dllexport problem

<Bob>
> If you look
> carefully at the DEFINES for the libCertDLL application, you 
> will find the
> following:
> 
> LIBCERTDLL_EXPORTS,VDASNACCDLL_API_EXPORTS
> 
> which in turn define "dllexport" declarations for all classes to be
> exported.  These same include files default the declaration 
> to "dllimport".
> In your case, you must have one or more of the defintions 
> defined for export
> OR defined to be ""; THEY MUST BE DEFINED IN THE APPLICATION 
> AS "dllimport"
</Bob>

Including "sm_api.h" without defining LIBCERTDLL_EXPORTS,
VDASNACCDLL_API_EXPORTS within my project, causes the definition 
LIBCERTDLL_API and VDASNACCDLL_API both to '__declspec(dllimport)'

(e.g. see libCertDLL.h:
#ifdef LIBCERTDLL_EXPORTS
#define LIBCERTDLL_API __declspec(dllexport)
#else
#define LIBCERTDLL_API __declspec(dllimport)
#endif
)

So my project should be built without errors.

But while creating my VC++ project, unfortunately I inserted
LIBCERTDLL_API="",VDASNACCDLL_API="" in C/C++ Compiler-> Preprocessor 
options (copied from a project of Smime VC workspace). These 
settings override the right LIBCERTDLL_API and VDASNACCDLL_API 
define both to "". 
So various classes and functions weren't defined as 'dllimport' 
as requested

Eliminating LIBCERTDLL_API="",VDASNACCDLL_API="" 
definitions, the include file "sm_api.h" included in my source 
code, declares various classes and functions correctly as 'dllimport' 

This tip eliminates the first two linker's errors


2) Debug Multithreaded vs. Debug Multithreaded DLL for run-time library

<Jonathan>
>	Try building it with "Debug Multithreaded DLL" rather than "Debug
> Multithreaded". This will get rid of some of the errors. The linkage of
> the C++ runtime libraries in your application must match the linkage
> used in the SFL. Since the SFL is linked to the C++ DLL library your
> application must be linked similarly.
</Jonathan>

I choosed Debug Multithreaded option for run-time library and I
set 'ignore libraries'= MSVCRTD.LIB within Link->input options
(because linker returned a warning and suggested to set the
last option). 
Using only CSM_AppLogin for login gave me no problem. Using
CSM_MsgToSign (instancing an object for a class) caused 
the wrong settings emerging.

Choosing Debug Multithreaded DLL options and eliminating
'ignore libraries'= MSVCRTD.LIB, make building project 
without errors.

This tip eliminates the other linker's errors

Thank's again
Gianluca