Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   $L .Obj no funciona (https://www.clubdelphi.com/foros/showthread.php?t=62714)

rastafarey 09-01-2009 18:33:45

$L .Obj no funciona
 
problemas para linkear un obj c++ a delphi 2007

Aqui el que produce el archivo c_obj.obj escrito y compliado en c++

c_obj.cpp
Código PHP:

extern "C" int _stdcall suma(int aint b);

int _stdcall suma(int aint b) { return (b); } 

Unidad.pas
Código Delphi [-]
unit Unidad;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

{$L c_obj.obj}

Function suma(a, b: integer): Integer; StdCall; external;

procedure TForm2.Button1Click(Sender: TObject);
begin
  Caption := IntToStr(Suma(1, 2));
end;

end.

he aqui el error
[Pascal Error] Unidad.pas(28): E2065 Unsatisfied forward or external declaration: 'suma'

Alquien sabe por que este codigo no funciona si deberiaf uncionar.

Aqui es un link a la misma pagiana de codegear jemplo donde hay un ejemplo que no funciona.

dec 09-01-2009 18:43:08

Hola,

Creo que la declaración de la función ha de estar en la cláusula "interface", y no en la cláusula "implementation". ¿No será por eso? :rolleyes: ;)

Al González 09-01-2009 19:47:09

¡Hola!

Encontré esto con Find in Files en Delphi 7, tal vez te sea de ayuda.

Código Delphi [-]
unit IdCompressionIntercept;

{  This file implements an Indy intercept component that compresses a data
   stream using the open-source zlib compression library.  In order for this
   file to compile on Windows, the follow .obj files *must* be provided as
   delivered with this file:

   deflate.obj
  ...
}
{
You may sometimes get the following compiler errors with this file:

...
IdCompressionIntercept.pas(152) Error: Unsatisfied forward or external declaration: '_tr_init'
IdCompressionIntercept.pas(153) Error: Unsatisfied forward or external declaration: '_tr_tally'
...

Do not be alarmed.  This is due to a bug in DCC32 in Delphi 4, 5, 6, plus C++Builder, 4, 5, and 6.

There is a workaround for this issue.  The workaround is to compile this unit separately from the other units and than build
Indy with a command such as DCC32 using the /M parameter.  DO not use the /B parameter as that does force everything
to be recompiled triggering the DCC32 error.

The batch files FULLC4.BAT, FULLC5.BAT, FULLC6.BAT, FULLD4.BAT, FULLD5.BAT and FULLD6.BAT now have the workaround in them so
we recommend that you use those to build Indy.

Borland is aware of the issue.
}

Es probable que haya un reporte al respecto en QualityCentral.

Saludos.

Al. :)


La franja horaria es GMT +2. Ahora son las 13:08:38.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi