Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Can i make a native .dll in C++ for C# personal use?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Sun May 15, 2011 1:02 pm    Post subject: Can i make a native .dll in C++ for C# personal use? Reply with quote

So... i want to know, if that is posible?... make a .dll with some functions (Memory functions) for use in C#?... I mean, add the reference and that's all.

What would be my limitations?. I know that in C# is feasible (i already have created one), but in C++ don't know.

tyvm.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun May 15, 2011 1:23 pm    Post subject: This post has 1 review(s) Reply with quote

Of course you can
but you should declare the function as:
Code:

__declspec( dllexport ) void myfunc( params . . ) {
 // etc
}

and then create a definition file for each function that should be exported from the dll
the .def file should look like that
Code:

LIBRARY MYDEF
EXPORTS
myfunc   @1
myfunc2 @2
// and so on . .


at the end, in your C# project use [DllImport("mydll.dll")] as usual

_________________
Stylo
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Sun May 15, 2011 1:42 pm    Post subject: Reply with quote

Stylo wrote:
at the end, in your C# project use [DllImport("mydll.dll")] as usual


Excellent!, but i guess that is possible add the dll from "Add references", or i'm wrong?.

tyvm!

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
Stylo
Grandmaster Cheater Supreme
Reputation: 3

Joined: 16 May 2007
Posts: 1073
Location: Israel

PostPosted: Sun May 15, 2011 10:50 pm    Post subject: Reply with quote

Kr wrote:
Stylo wrote:
at the end, in your C# project use [DllImport("mydll.dll")] as usual


Excellent!, but i guess that is possible add the dll from "Add references", or i'm wrong?.

tyvm!

no, since it's not a managed code
you can import the function using the following code
Code:

[DllImport("dllname.dll")]
public static extern myfunc( params . . );

then call it anywhere from your code

_________________
Stylo
Back to top
View user's profile Send private message
Krähne
Expert Cheater
Reputation: 0

Joined: 06 Jun 2010
Posts: 108
Location: Inside of my Kernel

PostPosted: Mon May 16, 2011 12:26 am    Post subject: Reply with quote

Stylo wrote:
Kr wrote:
Stylo wrote:
at the end, in your C# project use [DllImport("mydll.dll")] as usual


Excellent!, but i guess that is possible add the dll from "Add references", or i'm wrong?.

tyvm!

no, since it's not a managed code
you can import the function using the following code
Code:

[DllImport("dllname.dll")]
public static extern myfunc( params . . );

then call it anywhere from your code


Oh perfect dude, thanks a lot!.

_________________
Excuse me if you don't understand what I just said, but "english" isn't my native language.
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites