.NET King Logo Comments on: .NET DLLs and Unmanaged clients
Skip Navigation Links
Home
Weblog
How to... (video)
Articles
About us
Contact us
0 Items in Video cart!

.NET DLLs and Unmanaged clients (10/2/2006)

This is the e-mail that was forwarded to me containing two questions.
I'm Omar Adel from Gamalearn company. We met the last seminar in Crown Plaza-AbuDhabi, and i took your email to contact you if anything comes up.
As i was working on a new topic, which is creating a Dll using c# in visual studio 2005.
I completely made the dll and then made another program in Vb which calls it and the return values where successfully retrieved.
But, when i tried implementing this 'DLL' in another software that i'am working with, it gave me the following error
"Couldn't find an entry point to the "function name", it has to be exported".
I tried searching for some code samples and solutions for this "entry point" problem but i only found some minor details which doesnt fullfill the purpose.
And so, what i need to ask you is the following:
1- How to create a successful " Dll " with the 'Pinvoke' or the ' Entry point ' so that i can call it from anywhere ?
2- In visual studio 2005, i can create a dll using only c#, or i have to use it along with c++ ??
Thanks for your time, and i will be waiting for your answer
Best,
Omar Adel.. Developer


Dear Omar
 The answer is very simple. When you create a .NET dll, you can call it from any .NET application that has reference to it. But you actually do NOT register .NET assemblies, so each and every single application which calls the should have the full path to the dll, or the dll should be located in the same client application path. The problem happens when you want to deploy the application with the dll to another server or computer. In this case you need to make the dll a shared assembly.
It is also simple. Here are some straight forward references to learn how to do it.
 OK, but as I can see your problem is something else. Most probably you are trying to call the .NET DLL from an unmanaged code (from an application which is not developed with .NET like C++, VB 6.0 or ...). This is impossible without registering the DLL and creating the registry tlb reference. If you want to call a .NET dll from a non-.NET client you need to follow these steps:

  1. inside your DLL create an interface that contains your desired functions and have your class implement the interface (.NET classes are not exposed to unmanaged code and only interfaces are used to create the type library)
     
  2. In visual studio .NET go to your DLL project properties and under the Build tab check the Register for COM interop
  3. Step 2 will creates the required type library for your dll and registers it on the development machine, but to run it on another machine you need to go to Visual Studio .NET command line and use regasm.exe command line tool to register it before calling by an unmanaged code. Remember that it is a .NET dll, so you cannot register it with regsvr32.
  4. When you want to call it in your VB 6.0 application create the object variable of type interface that you created and then assign the class instance to the variable of type interface.
  5. Call any function like the normal com functions.

Important note: Not all your .NET functions will work in unmanaged code. Remember that the .NET specific parameters and return values are not supported in unmanaged code and functions with these return values or parameters will not work in unmanaged client.

Morale: Who cares about unmanaged code, in the near future everything will be .NET and I personally believe most of this hassle does not worth it.
If you need any help or additional explanation, just put a comment for this note.

By the way, a dll is nothing special. In any language that you can make a class and then compile it so that another application can call it, you have made a dll. So you can simply make DLLs out of anything (remember cupcakes in cat in the hat movies - lol).
Cheers
Alireza  


By: albion online gold for sale  
Take my word for it.
URL: http://www.nuskoolbreaks.net/forum/viewtopic.php?t=13431&start=0&postdays=0&postorder=asc&highlight=  
By: NBA 2K17 MT PC  
Now you tell me that she was not a knockout !
URL: http://www.official-automotive.com/index.php?do=/blog/1024/nba-2k17-is-practically-identical-to-real-basketball/  
By: fifa 17 coins  
How do you work here ?
URL: http://www.uk-mods.co.uk/showthread.php?4711-FIFA-17-Changes-for-Shooting-and-Penalties&p=5239#post5239  
By: 2rand[0,1,1]  
Special Delivery https://gist.github.com/a84d7c42d990787ab6993b317f25e76f prepare exposed price levitra emerge stocks Brock showed Barbier excerpts of email exchanges between government officials in an effort to show that they were under pressure from President Barack Obama's administration early in the spill to quickly estimate its size. One of the officials suggested they could determine the flow rate over time by "backtracking" from a current estimate.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Can I take your number? https://gist.github.com/a8ff3e42c54965f7c181898a30fa3c43 artist destroyed levitra cost uk delve attention Culture Secretary Maria Miller has written to local authorities saying her ‘strong preference’ was for councils to communicate with their communities. It has been reported that Miller has become frustrated with councils that are reluctant to break bad news to sections of their residents.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
The National Gallery https://gist.github.com/e1a23028882a34f957bfb80316486385 classes cheap levitra india finance adapted The company's performance plastics unit, which makes products for toy manufacturers, builders and carmakers, remained its largest business, accounting for nearly a quarter of total sales. Margins grew for a sixth straight quarter.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I'd like to open an account https://gist.github.com/6429176da5b5575b58bf00d5b484f7da remedy generations levitra purchase online push Eck and Melanchthon argued that it should be acceptable to lend modest amounts of money to those that had ample assets (well in excess of the loan) but wanted the loan as a convenient alternative to liquidating other assets — theirs was a theory of lending to the rich.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I study here https://gist.github.com/2c39fc510d935c423acf158d7923ba9d mystery cheap levitra professional beams imperial "By declaring his intention to make an offer for all of KPN, Slim has in reality drawn a line in the sand that tells Telefonica: This deal (E-plus) is not good enough," a person familiar with the matter said.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I live in London https://gist.github.com/a32ccdb930a9ba543da1c4b0d8ae3cc4 breed levitra order uk isolation When we got out of the hospital, we worked on our project in earnest. At the school library, we found almanacs, medical journals and even a book of actuarial tables from 1987. We gathered data, we computed and we recorded, filling up line after line with the raw evidence of human vulnerability.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
How much notice do you have to give? https://gist.github.com/78773f8c2131832ae9a7307d337c1cf7 however cracker levitra prices australia tape Because, let’s face it, in this country we simply can’t do slick, Bourne has had the courage to realise that what makes for a successful brand is not any pathetic aping of Florida or Vegas but, on the contrary, a determination to keep the Butlin’s brand traditionally, defiantly, British.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Could I have a statement, please? https://gist.github.com/15f02a9acaca0def85f5feaa743a431e tempted currant cheapest levitra/uk accessible nut Twenty-year-old Samantha Pittendrigh witnessed the incredible event with her friends Tanith Human, 20, Carmen Thvle, 21, and Michelle De Jager, 21. Pittendrigh instinctively recorded a video when she witnessed a herd of impalas racing for their lives.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Gloomy tales https://gist.github.com/0ca33caf0be6304623dd7e3179cfef92 castle juicy cheapcanadian levitra forest On July 30, Chesapeake sold its interest in trucking companyBig Star Crude for $3 million. The company sold its 10 percentinterest in natural gas producer Gastar Exploration Ltd for $10million cash in the current quarter, according to the filing.
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Sorry, I'm busy at the moment
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I'd like to order some foreign currency
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Languages
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Hello good day
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I'm from England
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I'm on business
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Do you need a work permit?
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Could I borrow your phone, please?
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
How many weeks' holiday a year are there?
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
What part of do you come from?
URL: 2rand[0,1,1]  
By: Anonymus  
URL:  
By: 2rand[0,1,1]  
A pension scheme
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
A book of First Class stamps
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Have you read any good books lately?
URL: 2rand[0,1,1]  
By: Anonymus  
URL:  
By: 2rand[0,1,1]  
Get a job
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Hold the line, please
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
I like watching football
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Whereabouts in are you from?
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
What's the interest rate on this account?
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
How much will it cost to send this letter to ?
URL: 2rand[0,1,1]  
By: 2rand[0,1,1]  
Could you send me an application form?
URL: 2rand[0,1,1]  
By: cheap fifa 17 coins  
The youre really talented .
URL: http://www.rcracer.com.au/phpbb3/viewtopic.php?f=13&t=110993  
By: fifa 17 coins  
I was wondering if after work we could grab a cup of coffee
URL: http://www.instappraisal.com/personal-suggestions-fifa-17-career-mode  
By: u4fifa  
I'm all yours��
URL: https://issuu.com/u4fifa  
Your name:
Email:
URL:
Comments:
 

 -