Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello, I have a console application created in c ++ that loads a dll, let's say target.dll, this library contains only one function

What I have tried:

void Print (char * text)
{
    // Code in c ++ to print in console
}

but I need to inject my own dll made in c # creating the same function

C#
public void Print (string text)
{
   Console.WriteLine (text);
}


Using EasyHook I manage to load my dll but it throws me the error
% 1 is not a valid win32 application
How could I make it funsional?
Greetings
Posted
Comments
Richard MacCutchan 17-Oct-21 3:24am    
You cannot pass a char* to a C# function that is expecting a C# string. And as you can see by the error message there are other incompatibilities between the two frameworks.

1 solution

I already found the solution, using the DllExport library
NuGet Gallery | DllExport 1.7.4[^]
I hope someone is helpful
 
Share this answer
 
v2

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