473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

VC++ Unmanaged DLL in C#.net

Hi All..

I have a VC++ unmanaged dll in the shared drive. I have to call that one in to my C# application which is residing on my local hard drive.

Clients restrictions are below

1) We should not register Vc++ dll on the local machine
2) We should not have the local copy of the dll

I am struck on this for last 5 days...I am not able to find the solution....

Please someone help me on this scenario....
Feb 11 '09 #1
4 2850
PRR
750 Expert 512MB
As far as i know you need to register the dll using Regsvr32
... then add reference or add com reference.... i have limited knowledge in this area .. so may be there are other ways ...
Feb 20 '09 #2
vekipeki
229 Expert 100+
Is it a COM object, or simply a native .dll? Why can't you P/Invoke it using DllImport?
Feb 20 '09 #3
It is not a COM dll. Is DLLImport is a runtime invocation method?
Feb 20 '09 #4
vekipeki
229 Expert 100+
Good point... I don't think you can change the DllImport path during runtime. I wonder if it could be done through some Reflection (or Reflection.Emit)?

Anyway, a general way would be to P/Invoke Kernel32.LoadLibraryW:

Expand|Select|Wrap|Line Numbers
  1. // using System.Runtime.InteropServices;
  2. [DllImport("kernel32.dll", EntryPoint = "LoadLibraryW")]
  3. static extern IntPtr LoadLibraryW([In][MarshalAs(UnmanagedType.LPWStr)] string lpLibFileName);
and then use Kernel32.GetProcAddress to get the function pointer to your native function.

I Googled for ".NET Kernel32 GetProcAddress" and this came up: http://blogs.msdn.com/jmstall/archiv...ocAddress.aspx
Feb 20 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Weston Fryatt | last post by:
(Sorry for spamming multiple groups, But I need a solution to this problem) I think this should be a simple question on Memory Allocation in a managed DLL and passing a memory pointer over to an...
3
by: Francis Urquhart | last post by:
I am trying to find the simplest possible way of writing a GUI to run on top of a standard C++ library written in VC++. I would like to avoid MFCs, COM, and if possible .Net wrappers. The goal...
2
by: | last post by:
Everything seems to be moving to .NET and VC++ seems to be adding a lot of managed code support every new release. The questions: is unmanaged code in VC++ beeing phased out in favour of managed...
6
by: Ben Terry | last post by:
Hello, I have a VS 2003.NET solution which consists of four c++ unmanaged legacy projects. I am adding a new project to the solution which will be in c#. What do I need to do to my c++ projects...
1
by: Steve | last post by:
We are considering the ways to migrate our VC++ 6.0 applications to .NET platform. It would be nice to rewrite them completely in C#, but due to the time constraints this option is out of...
8
by: The unProfessional | last post by:
To the VC .Net'ers out there... I noticed alot of strange behavior in the way VC .Net apps behave in the IDE. It's a bit odd, so maybe people have workarounds. I'm worried to devote my project...
12
by: Maansi Sanghi | last post by:
Hi, Is there a way to use the System.Xml.Schema classes in VC++ 6.0? Regards, Maansi
3
by: doubts | last post by:
Hi all, I am trying to convert my bulk of code from VC++ 6.0 to VC++.Net. when using std::string type variable, the application causes exception at one instance and does not cause an exception at...
5
by: Andy | last post by:
I'm having trouble accessing an unmanaged long from a managed class in VC++.NET When I do, the contents of the variable seem to be mangled. If I access the same variable byte-by-byte, I get the...
13
by: Creativ | last post by:
I've looked through this thread and still have quetions. Suppose In visual studio 2005, I write the following #pragam managed class ManagedWrapper { void CallUnmanagedMethod() // The unmanaged...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.