By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,564 Members | 810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,564 IT Pros & Developers. It's quick & easy.

Problem converting unmanaged DLL to managed

P: n/a
Sin
Hello everyone,

I'm currently trying to migrate a MSVC6 project to .NET... The straight
conversion (ie : unmanaged) was extremely straightforward. Now I'm trying to
compile and hopefully run the project as managed to estimate the kind of
performance difference there will be for the kind of applications we do
here.

The project is composed of a EXE and 5 different DLLs. One of these DLL is
unmanaged (VC6) and can hopefully stay that way for my test since I do not
have access to the source code.

I got the whole thing to compile rather quickly in Release, but the thing
won't run. The program starts and ends immediatly, without any error or
warning from the OS.

I then tried to compile in Debug but got a couple errors concerning a /RTC1
and /clr conflict. After some research, I found out I had to use /NOENTRY to
avoid this error. This brought another problem. All the DLLs except one
(haven't found the reason yet) scream they can't find _main (LNK2019).

I messed around, looked on the net and couldn't find a reason why a DLL
would want a main... I simply added this :

void __cdecl main(void) {}

... and it "fixed" the compilation error... The Debug EXE doesn't work
either, but now I can at least see what the following errors are occuring :

'Opti.exe': Loaded 'C:\Projets\Debug.BIN\ConvMan.dll', Symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorw ks.dll', No symbols
loaded.
'Opti.exe': Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\msvcr7 1.dll',
Symbols loaded.
'Opti.exe': Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\fusion .dll',
No symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorl ib.dll', No symbols
loaded.
First-chance exception at 0x00000000 in Opti.exe: 0xC0000005: Access
violation reading location 0x00000000.
First-chance exception at 0x791b970e in Opti.exe: 0xC0000005: Access
violation reading location 0x000001a6.
The thread 'Win32 Thread' (0x560) has exited with code -2146233082
(0x80131506).
The program '[468] Opti.exe: Native' has exited with code -2146233082
(0x80131506).

I'm a bit confused now... It seems the "bug" happens before my code is even
called. I suppose this is a common problem and that perhaps someone could
help me with it...

Thanks alot,

Alex.
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Sin
<Bump>

I can't beleive nobody here has any idea on how to resolve this...

Thanks,

Alex.
"Sin" <br****@hotmail.com> a écrit dans le message de
news:uN**************@TK2MSFTNGP11.phx.gbl...
Hello everyone,

I'm currently trying to migrate a MSVC6 project to .NET... The straight
conversion (ie : unmanaged) was extremely straightforward. Now I'm trying to compile and hopefully run the project as managed to estimate the kind of
performance difference there will be for the kind of applications we do
here.

The project is composed of a EXE and 5 different DLLs. One of these DLL is
unmanaged (VC6) and can hopefully stay that way for my test since I do not
have access to the source code.

I got the whole thing to compile rather quickly in Release, but the thing
won't run. The program starts and ends immediatly, without any error or
warning from the OS.

I then tried to compile in Debug but got a couple errors concerning a /RTC1 and /clr conflict. After some research, I found out I had to use /NOENTRY to avoid this error. This brought another problem. All the DLLs except one
(haven't found the reason yet) scream they can't find _main (LNK2019).

I messed around, looked on the net and couldn't find a reason why a DLL
would want a main... I simply added this :

void __cdecl main(void) {}

.. and it "fixed" the compilation error... The Debug EXE doesn't work
either, but now I can at least see what the following errors are occuring :
'Opti.exe': Loaded 'C:\Projets\Debug.BIN\ConvMan.dll', Symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorw ks.dll', No symbols
loaded.
'Opti.exe': Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\msvcr7 1.dll', Symbols loaded.
'Opti.exe': Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\fusion .dll', No symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorl ib.dll', No symbols
loaded.
First-chance exception at 0x00000000 in Opti.exe: 0xC0000005: Access
violation reading location 0x00000000.
First-chance exception at 0x791b970e in Opti.exe: 0xC0000005: Access
violation reading location 0x000001a6.
The thread 'Win32 Thread' (0x560) has exited with code -2146233082
(0x80131506).
The program '[468] Opti.exe: Native' has exited with code -2146233082
(0x80131506).

I'm a bit confused now... It seems the "bug" happens before my code is even called. I suppose this is a common problem and that perhaps someone could
help me with it...

Thanks alot,

Alex.

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.