Good afternoon or other relevant time period, Experts.
I have created a DLL in Delphi 7, within which I have a single external function with the following 4 lines of code
Form1 := form1.create(application);
Result := PChar(Form1.StringVariable);
In Word I have created a macro to run the function, retreiving the value as a string, which then uses that string value to set the save directory. This works perfectly, but only once - any attempt to run the macro a second time withouteither restarting Word or going into VBA and resetting the macro will cause the DLL to crash after closing the screen (i.e. on setting the result). I have tried creating a test Delphi application to run the macro, which did not bump into this problem.
Any help would be much appreciated,
nB1: Trying to create a second function in the same DLL and running it through Word VBA, one with a PChar declared as a string didn't work at all (causing Word to crash), while one with an integer worked fine.
nB2: Not sure whther this belongs in Office, VB or Delphi. I'll try here first and see what response I get, then move on. Any suggestion on where it would be best asked would be appreciated.