0

I use RAD Studio 10.1 Update 2 and have to initialize the NI PXIe-1073 from National Instruments. I use the same command like in Delphi 7:

result:= niDCPower_InitializeWithChannels('PXI1Slot2',
                                            '0',
                                            true,   
                                            'Simulate=0, DriverSetup=Model:4138; BoardType:PXIe',   
                                            session) = false;

The function has the next parameters:

function niDCPower_InitializeWithChannels(resourceName: string;
                                          channels: string;
                                          reset: boolean;
                                          optionString: string;
                                          var vi: integer): boolean cdecl  {$IFDEF WIN32} stdcall {$ENDIF};

I have a Problem: this works with Delphi 7 but dosn't work with RAD Studio 10.

What could the problem be?

Thanks in advance.

genakust
  • 89
  • 9
  • Doesn't work is broad. You might want to add some specifics. Does it compile? Does it raise an error when executed? It executes without fault but does not achieve the expected result? – nil Oct 13 '17 at 09:44
  • @nil It executes without result, it means result = false and I can compile the project. – genakust Oct 13 '17 at 09:51
  • 1
    String is an unicode string in 10, but was an ansistring in 7 - this might be the issue here. – Sebastian Proske Oct 13 '17 at 09:59
  • Welcome to unicode. Next. – J... Oct 13 '17 at 10:45
  • Also, the method you're calling just looks wrong. The arguments are Delphi style strings but it's decorated with `cdecl` or `stdcall`, meaning you're either importing it from an NI library or exporting it to a DLL (or it's decorated superfluously as such). In either former case, using `string` for the arguments is just wrong. Suggest you consult the NI documentation for the library, re-read the C headers (and post the relevant entries here), re-import the TLB if you're using one, etc. There isn't enough information here to help you. – J... Oct 13 '17 at 11:06
  • @J... Thank you very much. I read the article [link](http://edn.embarcadero.com/article/images/38980/Delphi_and_Unicode.pdf) and changed `string` to `ansistring`. It seems to work! – genakust Oct 13 '17 at 11:23

0 Answers0