| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 17023 | 2002-03-25 09:11:00 | pChar passing to DLL | Guest (0) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 40426 | 2002-03-25 09:11:00 | I have a DLL called by MAIN as listed below. When I put the code in the main program it works fine. When calling the DLL it doesn't show the text 'Test 123' but 'A@A' or similar rubbish. This must be a pointer issue I suppose. Any ideas? TIA John. -------------------- MAIN PROGRAM: procedure TForm1.Button1Click(Sender: TObject); var p : pChar; begin p := strAlloc(1000 * sizeOf(char)); strPCopy(p, 'Testing 123'); ShowStr(p, true); strDispose(p); end; -------------------- IN THE DLL: procedure ShowStr(pSQL : pChar; boAll : boolean); StdCall; var s : string; begin s := string(pSQL); showMessage(s); // the dll shows rubbish text like 'A@A' end; |
Guest (0) | ||
| 40427 | 2002-03-25 11:50:00 | A character string of any length is compatible with the PChar type when the extended syntax is enabled {$X+}. | Guest (0) | ||
| 1 | |||||