473,809 Members | 2,506 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 4086
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
4477
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
1678
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
2593
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
2741
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
2000
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
3946
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
1482
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
3102
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
2583
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
9603
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,...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
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
5550
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
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.