views:

108

answers:

1
char ARRAY[1024]; // <-- global


Code below works

myFunctionInDll("some string"); // everything ok


Code below doesn't work

myFunctionInDll(ARRAY); // after compilation the entry point of DLL cannot be found

So, to sum up, if I pass a "static string" to my function inside my dll the dll compiles and loads perfectly. However, if I populate the global array (chars) and then try and pass that to my function, again it compiles but when I try and call the function from my C# app I get 'entry point cannot be found.' This is really strange and I can find no reason why...

Thanks RU.

Anyone know why?

+1  A: 

Did you write the interop or are you just using the .NET generated interop class? If the later try

string myStr = "some string";
myFunctionInDll(myStr);

Hope that helps.

another average joe
Thanks joe. This sounds counter intuitive but I later realised that I was actually doing things correctly which is why it wasn't working... It was part of a rootkit test for a uni project and I realised that the module was being hidden, which is why the string function couldn't be passed to the dll, because it couldn't see it! Pretty funny actually :)
flavour404