473,695 Members | 2,533 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem converting unmanaged DLL to managed

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\Deb ug.BIN\ConvMan. dll', Symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\m scorwks.dll', No symbols
loaded.
'Opti.exe': Loaded 'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\m svcr71.dll',
Symbols loaded.
'Opti.exe': Loaded 'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\f usion.dll',
No symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\m scorlib.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
1 4080
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******** ******@TK2MSFTN GP11.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\Deb ug.BIN\ConvMan. dll', Symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\m scorwks.dll', No symbols
loaded.
'Opti.exe': Loaded 'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\m svcr71.dll', Symbols loaded.
'Opti.exe': Loaded 'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\f usion.dll', No symbols loaded.
'Opti.exe': Loaded
'C:\WINNT\Micro soft.NET\Framew ork\v1.1.4322\m scorlib.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
4438
by: _BNC | last post by:
I've converted " byte" to "byte *" at times, using 'unsafe' and fixed { .... }, but the reverse does not seem to work. In this case, a C++ DLL returns a byte * and a length. What is the best way to convert these to straight C#-compatible straight " byte" arrays? PS: The C++ DLL is actually managed and I have access to the source. Perhaps there is a simpler syntax for doing the conversion there, and returning a C# compatible array...
0
1673
by: Edward Diener | last post by:
I have some questions about the instructions for creating a mixed mode DLL in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the "Managed Extensions for C++ Reference". 1) The first instruction in converting to mixed mode is to link with /NOENTRY. This occurs despite the fact that a pure mode DLL is already set up with this option in the linker, and the previous...
9
2588
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and explain it. I have some questions about the instructions for creating a mixed mode DLL in the MSDN topic "Converting Managed Extensions for C++ Projects from Pure Intermediate Language to Mixed Mode" in the "Managed Extensions for C++ Reference"....
3
2735
by: Tom Glenn | last post by:
I have a managed method that has an int parameter that has to be passed to an unmanaged method that takes a PBYTE and associated length as a DWORD. Anyone have any sample code that shows how to do this? Thanks.
8
1995
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid the usage of old style COM, my alternative is to expose my unmanaged interface through the CLI, to achieve that I have created a mixed mode DLL in which my unmanaged class are defined. When referencing the DLL just described in another mixed mode EXE...
0
3935
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen. It is almost like it is trying to implement it's own COM interfaces... below is the header, and a link to the dll+code: Zip file with header, example, and DLL:...
1
1471
by: Sasha Nikolic | last post by:
I have defined a managed class ( __gc ) and a unmanaged ( __nogc ) in a separate files (but in the same vc++ dotnet project). I have no problem of referencing the unmanaged class from the menaged one. My problem is that I cannot reference managed class from the unmanaged. In my unmanaged class, if I use "using namespace ManagedNamespace;" I get error C2871: a namespace with this name does not exist. I get the simmilar error when trying...
8
3097
by: Nadav | last post by:
Hi, Introduction: ********************* I am writing a mixed mode application I have a COM module and a .NET module that communicate with each other. The COM exposes a custom sink interface, the .NET module implement the Sink interface ( IUnknown based ) and the COM call the methods of this interface asynchronously.
1
2577
by: DaTurk | last post by:
I'm having an issue converting an unmanaged struct to a CLI managed struct. It's a value struct and this cannot be changed. public value struct UpdateItem { public: System::String ^Name;
0
8642
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9126
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8833
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6500
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5841
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4349
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4588
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.