I wrote a library that has some functions that are exported. Example:
[DllExport("Test", CallingConvention = CallingConvention.StdCall)] public static void Test() { MessageBox.Show("Test 1"); } [DllExport("Test2", CallingConvention = CallingConvention.StdCall)] public static void TestTwo() { MessageBox.Show("Test 2"); Test();
When I call Test from an external application (Delphi), it works fine, and I get a message box.
When I call Test2 , I get an External exception in Delphi. An exception is thrown right away; it doesn't even show me the Test 2 message box. When I call Test2 , which in turn calls TestThree , which is not an exported function, it works fine, and I get both Test 2 and Test 3 message boxes.
Why can't I call other exported functions inside my dll? Is there any way I CAN do this?
EDIT 1:
At this point, I could achieve what I need by doing the following: Create another unexported function Test_Local() , move all the code from Test . Now, instead of calling Test() from TestTwo I call Test_Local() , the Test function also calls Test_Local();
Everything works fine until Test_Local() tries to run any other exported function.
So it’s incorrect to call the exported function inside another exported function, and it doesn’t matter how many layers between them are not exported.
source share