|
.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:
- 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)
- In visual studio .NET go to your DLL project properties and under the
Build tab check the Register for COM interop

- 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.
- 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.
- 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:
Fitflop UK Beads |
|
|
URL:
http://www.fitflopssaleclearanceuk.com/fitflop-uk-beads-c4.html
|
|
By:
albion online gold for sale |
|
|
URL:
http://www.nuskoolbreaks.net/forum/viewtopic.php?t=13431&start=0&postdays=0&postorder=asc&highlight=
|
|
By:
NBA 2K17 MT PC |
|
|
URL:
http://www.official-automotive.com/index.php?do=/blog/1024/nba-2k17-is-practically-identical-to-real-basketball/
|
|
By:
fifa 17 coins |
|
|
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] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
2rand[0,1,1] |
|
|
URL:
2rand[0,1,1]
|
|
By:
cheap fifa 17 coins |
|
|
URL:
http://www.rcracer.com.au/phpbb3/viewtopic.php?f=13&t=110993
|
|
By:
fifa 17 coins |
|
|
URL:
http://www.instappraisal.com/personal-suggestions-fifa-17-career-mode
|
|
By:
u4fifa |
|
|
URL:
https://issuu.com/u4fifa
|
|
|
|
|
|
|
|
|