Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi all,

I realy thanks for guy about anything mention in:
http://www.codeproject.com/KB/atl/SimpleATLComWithDotNet.aspx

But in this tutorial just mention about adding METHODS into COM/ATL DLL and use it in C#....and didnt mention about adding FUNCTIONS.

i tried to add a FUNCTION but unsuccessfully. Can you tell me the way to adding FUNCTIONS into COM/ATL DLL and can use it in C#.

if you dont mind, give me a brief example.

thanks all

@Samer Abu Rabie: thanks im reading it now
@Christian Graus: i dont want to give concept about Function or Method, but in my situation i write a method and a function in same class, i build it into DLL and use in C#. But when i use this class C# just recognize the method and not function.

@Christian Graus:I have just learnt COM/ATL DLL though this Tutorial:A Beginner Tutorial for Writing Simple COM/ATL DLL and Using it with .NET [^]
and that's all my knowledge about it.

Here my sample code: http://www.mediafire.com/?wgmzmjoyxyk[^]
solution ATL_SimpleSample: create ATL DLL file, my function and method in math2 class(math2.cpp)
solution CallATL: to use DLL file,please see program.cs file. i can use Multi method, but MultiReturn function.
Posted
Updated 24-Jun-21 20:44pm
v3

Well here is a link on how to to call unmanaged dlls in C#, hope this helps:
http://msdn.microsoft.com/en-us/magazine/cc301501.aspx[^]
 
Share this answer
 
When you add a method ( a function is the same thing, sorry, I have no idea what you're talking about ), so long as it's exposed on the COM interface, you can import it and call it. I don't know if p/invoke works with dll methods in a COM dll. If you have some concept of how a method and a function are different, you're probably wrong, but you should edit your post to explain what you mean, so we can answer you.
 
Share this answer
 
silva103 wrote:
@Christian Graus: i dont want to give concept about Function or Method, but in my situation i write a method and a function in same class, i build it into DLL and use in C#. But when i use this class C# just recognize the method and not function.



I'm sorry, but 10 years of experience as a developer, including quite some time with COM, and apart from the possibility that you think it's a function if it does not appear in the interface ( which is false ), I have no idea what the hell you're talking about.

Like I said, I am not sure that a COM dll can have the methods not on it's interface called via p/invoke, which is surely what the other guy linked to.
 
Share this answer
 
how to Create a ATL DLL(VS 2017) And Export's It In VB 2017 If you Know Please suggest me what can i do for lenr it and if you have a project in 2017 for it please share me
 
Share this answer
 
Comments
CHill60 25-Jun-21 5:49am    
If you have a question, then use the red "Ask a Question" link at the top of this page. Do not post questions or comments as a solution to another member's post

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900