API calls to a native DLL

From: Mali Guven (guvenma_at_hotmail.com)
Date: 11/25/03


Date: 25 Nov 2003 09:37:37 -0800

Hi All:

I have written a delphi application which calls a commercial
optimization library distributed in the form of a DLL. I have to pass
one integer and two integer arrays to one of its callable native
functions (named LSloadBasis).

The delphi prototype for the native function is as follows,

//-------------------------
function LSloadBasis (
   nModel : Integer;
   Var anCstatus : Array of Integer;
   Var anRstatus : Array of Integer) : Integer;
   stdCall;
   external 'lindo2_0.dll';
//-------------------------

  I use the following declaration and code fragment to call the native
function

//
  anRstat : array[0..2] of Integer;
  anCstat : array[0..3] of Integer;

  anRstat [0] := 20;
  anRstat [1] := 30;

  anCstat [0] := 120;
  anCstat [1] := 60;
  anCstat [2] := 50;

  nErr := LSloadBasis(nModel, anRstat, anCstat);
//

During this call, I keep getting a memory exception and my application
terminates. I contacted the company developing the DLL but they do not
provide tech support for language specific issues. Any help would be
truly appreciated.

If it may help, the C/C++ prototype of the native function is given in
official header file distributed by the company is as follows

int CALLTYPE LSloadBasis(pLSmodel pModel,
                         int *panCstatus,
                         int *panRstatus);

Thanks in advance.

Mali Guven



Relevant Pages

  • Re: Using VB6 dll in Delphi app.
    ... to make a *windows standard* .dll with VB6. ... The trouble occurs when we try to use it in a Delphi app. ...
    (microsoft.public.vb.general.discussion)
  • Re: New Delphi roadmap is coming: NO UNICODE PLEASE!
    ... Avoids DLL hell, because it ... The app is deployed and the user is getting an error. ... instances where upgrading .NET broke things that were working. ... Coming from Delphi, this isn't any big deal of course. ...
    (borland.public.delphi.non-technical)
  • Re: DLL with string params callable via D4 and VB
    ... > I have a DLL written in D6 that uses ShortStrings as parameters. ... I can't get beyond Delphi to ... > Is there any guidance you could give in regards to passing string ... written in order to be used by EXCEL 97 VBA. ...
    (borland.public.delphi.language.objectpascal)
  • Re: Why wont this work ?
    ... Yeap, more of a personal tool than a commercial offering, all of the other ... BHO tools i have found just dont seem to offer very much information, ... more about the dll, and hopefully will try and reveal what functions the ... Delphi IDE or RegSvr32 which brings us back in a full circle .... ...
    (alt.comp.lang.borland-delphi)
  • Re: Use of delegate
    ... Delphi application which I wrote. ... VB.NET relies on that Chainlink DLL, ... > Peter Huang ... > Private Sub Button2_Click(ByVal sender As System.Object, ...
    (microsoft.public.dotnet.languages.vb)