From: Øystein Skotheim on
Giovanni Dicanio wrote:

> "�ystein Skotheim" <oystein(a)dontspam.me> ha scritto nel messaggio
> news:g6s7tf$a0n$1(a)kuling.itea.ntnu.no...
>
>> 3DWorkBench.exe (C++/CLI) MFC in shared DLL CLR=Yes CRT=MT DLL
>> AcqusitionLib.lib (C++) Standard Windows lib. CLR=No CRT=MT DLL
>> GCPS.lib (C++) MFC in shared DLL CLR=No CRT=MT DLL

> Would it be possible - at least for test - to try to set CLR support
> "CLR=Yes" also in the GCPS.lib ?
> The GCPS.lib is the only one to be in config state "MFC in shared DLL; CLR =
> No".

> Maybe some errors can occur if MFC in shared DLL is used, but modules with
> CLR=No are linked with modules with CLR=Yes ?

Hello and thanks for the advice. I tried to enable the "/clr" flag for
my native GCPS library, but then I just get a bunch of complaints that
the compiler cannot compile my C source files with the /clr option.

Regards,
--

�ystein Skotheim
Scientist, Optical Measurement Systems and Data Analysis
SINTEF ICT [http://www.sintef.com/omd]
From: Øystein Skotheim on
Ben Voigt [C++ MVP] wrote:

>> Sorry, it was a typing error. I use VS2005, and all my code is
>> compiled with this version of Visual Studio. Thanks for being
>> observant :-)
>
> Hmm, then what I just said (undoing VS2005-specific fixes) won't be much
> help.
>
> Can you try with VS2008? There's a free version of the C++ compiler and
> basic IDE (no plugins usable) called Visual C++ 2008 Express Edition.

Hello Ben. I tried to download Visual C++ 2008 Express Edition today.
However, it is not usable to compile my project because I use the MFC
library and apparently this is not included in the expression edition of
VC++ 2008.

--

�ystein Skotheim
Scientist, Optical Measurement Systems and Data Analysis
SINTEF ICT, Trondheim, Norway
From: Ben Voigt [C++ MVP] on
�ystein Skotheim wrote:
> Ben Voigt [C++ MVP] wrote:
>
>>> Hello again and thank you for your answer. I tried to do debug as
>>> you suggested. Now the debugger stops on line 109 of file
>>> atonexit.c: retval = __dllonexit(func, &onexitbegin, &onexitend);
>
>>
>> This is a LOT more useful. It looks like the problem is with global
>> variable or members of a global variable afxModuleState, and
>> registering destructors to automatically run.
>>
>> I think whatever you did to "fix" VS2005 is causing the trouble. Can you
>> undo that, probably by making sure than the entry point name
>> is not specified in the project properties?
>
> Hello. I tried to remove these "fixes", but the application still
> crashes at the same point.
>
> I discovered one difference in the project settings for
> GcpsDotNetApi.dll between debug and release modes. In release mode the
> "/NOENTRY" option was given to the linker, whether this was not done
> in debug mode.
>
> I tried to remove this option in release mode, but then I do not
> manage to link this DLL any more due to the following error:
>
> mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain(a)12 already defined
> in MSVCRT.lib(dllmain.obj)

I think this indicates that not all your source files are using the same
runtime library settings (i.e. /MT and whatever the equivalent is for "Use
MFC in a Shared Library").

>
> I tried to follow advice in this support article:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;q148652
>
> I insert "mfcs80.lib;msvcrt.lib" in the ignore libraries box, and
> then I list these libraries in the input box before all other items,
> starting with the MFC library. However, I still get the same error when
> linking.
> Do you that this "/NOENTRY" option could cause the crash of my
> application?
> This is the output of the linker with /VERBOSE:lib option.
>
> ------ Build started: Project: GcpsDotNetApi, Configuration: Release
> Win32 ------
> Linking...
> LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/LTCG'
> specification Searching libraries
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcrt.lib: Searching
> ..\libhvutil\release\LibHvUtilSim.lib: Searching
> ..\release\GCPS.lib: Searching
> ..\..\Geom3D\trunk\Geom3D\release\Geom3DLib.lib: Searching
> C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\MSVCMRT.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\MSCOREE.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcprt.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfc80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\kernel32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\user32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\gdi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\msimg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comdlg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\winspool.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\advapi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shell32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comctl32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shlwapi.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\uuid.lib: Searching C:\Program Files\Microsoft Visual
> Studio 8\VC\PlatformSDK\lib\oledlg.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ole32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\oleaut32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\urlmon.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbc32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbccp32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\daouuid.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\atls.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\wininet.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ws2_32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\mswsock.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain(a)12 already defined
> in msvcrt.lib(dllmain.obj)
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcrt.lib: Searching
> ..\libhvutil\release\LibHvUtilSim.lib: Searching
> ..\release\GCPS.lib: Searching
> ..\..\Geom3D\trunk\Geom3D\release\Geom3DLib.lib: Searching
> C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\MSVCMRT.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\MSCOREE.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcprt.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfc80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\kernel32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\user32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\gdi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\msimg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comdlg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\winspool.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\advapi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shell32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comctl32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shlwapi.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\uuid.lib: Searching C:\Program Files\Microsoft Visual
> Studio 8\VC\PlatformSDK\lib\oledlg.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ole32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\oleaut32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\urlmon.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbc32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbccp32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\daouuid.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\atls.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\wininet.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ws2_32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\mswsock.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcrt.lib: Searching
> ..\libhvutil\release\LibHvUtilSim.lib: Searching
> ..\release\GCPS.lib: Searching
> ..\..\Geom3D\trunk\Geom3D\release\Geom3DLib.lib: Searching
> C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\MSVCMRT.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\MSCOREE.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcprt.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfc80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\kernel32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\user32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\gdi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\msimg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comdlg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\winspool.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\advapi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shell32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comctl32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shlwapi.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\uuid.lib: Searching C:\Program Files\Microsoft Visual
> Studio 8\VC\PlatformSDK\lib\oledlg.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ole32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\oleaut32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\urlmon.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbc32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbccp32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\daouuid.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\atls.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\wininet.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ws2_32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\mswsock.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Finished searching libraries
> Searching libraries
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcrt.lib: Searching
> ..\libhvutil\release\LibHvUtilSim.lib: Searching
> ..\release\GCPS.lib: Searching
> ..\..\Geom3D\trunk\Geom3D\release\Geom3DLib.lib: Searching
> C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\MSVCMRT.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\MSCOREE.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcprt.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfc80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\kernel32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\user32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\gdi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\msimg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comdlg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\winspool.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\advapi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shell32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comctl32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shlwapi.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\uuid.lib: Searching C:\Program Files\Microsoft Visual
> Studio 8\VC\PlatformSDK\lib\oledlg.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ole32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\oleaut32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\urlmon.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbc32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbccp32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\daouuid.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\atls.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\wininet.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ws2_32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\mswsock.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcrt.lib: Searching
> ..\libhvutil\release\LibHvUtilSim.lib: Searching
> ..\release\GCPS.lib: Searching
> ..\..\Geom3D\trunk\Geom3D\release\Geom3DLib.lib: Searching
> C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\MSVCMRT.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\MSCOREE.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcprt.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfc80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\kernel32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\user32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\gdi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\msimg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comdlg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\winspool.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\advapi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shell32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comctl32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shlwapi.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\uuid.lib: Searching C:\Program Files\Microsoft Visual
> Studio 8\VC\PlatformSDK\lib\oledlg.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ole32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\oleaut32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\urlmon.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbc32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbccp32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\daouuid.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\atls.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\wininet.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ws2_32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\mswsock.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Finished searching libraries
> Searching libraries
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfcs80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcrt.lib: Searching
> ..\libhvutil\release\LibHvUtilSim.lib: Searching
> ..\release\GCPS.lib: Searching
> ..\..\Geom3D\trunk\Geom3D\release\Geom3DLib.lib: Searching
> C:\Program Files\Microsoft Visual Studio 8\VC\lib\OLDNAMES.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\MSVCMRT.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\MSCOREE.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\msvcprt.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\mfc80.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\kernel32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\user32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\gdi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\msimg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comdlg32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\winspool.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\advapi32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shell32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\comctl32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\shlwapi.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\lib\uuid.lib: Searching C:\Program Files\Microsoft Visual
> Studio 8\VC\PlatformSDK\lib\oledlg.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ole32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\oleaut32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\urlmon.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbc32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\odbccp32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\daouuid.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\atlmfc\lib\atls.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\wininet.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\ws2_32.lib:
> Searching C:\Program Files\Microsoft Visual Studio
> 8\VC\PlatformSDK\lib\mswsock.lib:
> Finished searching libraries
> C:\SVN2\Auto3D\3DWorkBench\Release\GcpsDotNetApi.dll : fatal error
> LNK1169: one or more multiply defined symbols found
> Build log was saved at
> "file://c:\SVN2\Auto3D\3DWorkBench\GcpsDotNetApi\Release\BuildLog.htm"
> GcpsDotNetApi - 2 error(s), 1 warning(s)
> ========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped
> ==========
> Regards,


From: Øystein Skotheim on
Ben Voigt [C++ MVP] wrote:

>> mfcs80.lib(dllmodul.obj) : error LNK2005: _DllMain(a)12 already defined
>> in MSVCRT.lib(dllmain.obj)
>
> I think this indicates that not all your source files are using the same
> runtime library settings (i.e. /MT and whatever the equivalent is for "Use
> MFC in a Shared Library").

I managed to make this link error go away by checking out the code again
from Subversion and compiling and linking everything from scratch.

However, I still get the same crash in GcpsDotNetApi.dll!`dynamic
initializer for 'afxModuleState''() Line 66 + 0x14 bytes

It appears that this is caused by the use of the MFC library in the .NET
component GcpsDotNetApi.dll. I think the variable afxModuleState is
defined somewhere in the afx header files.

I read about initialization of mixed assemblies here:
http://msdn.microsoft.com/nb-no/ms173266(en-us).aspx

I think my problem might be some kind of "loader lock issue" , but I
have no idea how to fix it, since I did not declare the afxModuleState
variable myself, and hence I cannot put e.g. #pragma unmanaged on it.

I have been trying for many days now to solve the problem but still no
success. I found this Microsoft article describing a somewhat similar
problem:
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99715

I have tried to replace the main subroutine with CWinApp::InitInstance()
in my main application and changing the entry point from main to
WinMainCRTStartup but I still get the same crash. (I guess I would have
to change something in GcpsDotNetApi.dll and not in my main application
to get rid of this problem).

Do you have any further ideas on what might be wrong? Do you know of any
support e-mail addresses or newsgroups that would put me in direct
contact with people from the Visual C++ team in Microsoft regarding this
problem?

Regards,
--

�ystein Skotheim
Scientist, Optical Measurement Systems and Data Analysis
SINTEF ICT, Trondheim, Norway
From: Giovanni Dicanio on

"�ystein Skotheim" <oystein(a)dontspam.me> ha scritto nel messaggio
news:g792kn$tpl$1(a)kuling.itea.ntnu.no...

> Do you have any further ideas on what might be wrong? Do you know of any
> support e-mail addresses or newsgroups that would put me in direct contact
> with people from the Visual C++ team in Microsoft regarding this problem?

I think that to get better help you may try to provide a reproducible
minimal example.
(e.g. a VS2008 solution download with minimal source code, which reproduces
the crash.)

Giovanni