From: "Paul Whittington" <paul@sage.inel.gov>
Subject: OLE Automation with Win32Ada and Personal ObjectAda
Date: 1996/09/25
Date: 1996-09-25T00:00:00+00:00 [thread overview]
Message-ID: <01bbaaf8$07a9a3f0$24af1486@pc-phw> (raw)
Can anyone help?
I'm trying to get a very small OLE program working as part of a larger
effort. As GNAT/NT with Win32Ada is not yet available I've only tried to
compile and link with Personal ObjectAda. I get several "unresolved
external symbol"s and can't seem to find a .lib or .obj(s) to link with to
resolve externals.
I've called Thompson Software twice for tech support and e-mail them with
no response in 18 hours.
Here are the linker errors:
ObjectAda (tm) version 7.0.100: adabuild
Copyright (c) 1996, Alsys, Inc. All Rights Reserved.
obj\controller.eltab.obj
link /nologo @controller.rsp
av$win32.lib(objbases.obj) : error LNK2001: unresolved external symbol
_IID_IWeakRef
av$win32.lib(objbases.obj) : error LNK2001: unresolved external symbol
___MIDL__intf_0000_v0_0_s_ifspec
av$win32.lib(objbases.obj) : error LNK2001: unresolved external symbol
___MIDL__intf_0000_v0_0_c_ifspec
av$win32.lib(objbases.obj) : error LNK2001: unresolved external symbol
_IWinTypes_v0_1_s_ifspec
av$win32.lib(objbases.obj) : error LNK2001: unresolved external symbol
_IWinTypes_v0_1_c_ifspec
controller.exe : fatal error LNK1120: 5 unresolved externals
Link of controller failed rc=25.
Tool execution failed.
Here is the source:
with OLE.OLE_String;
with Win32.Objbase; use Win32.Objbase;
with Win32.Winerror; use Win32.Winerror;
with Win32.Winnls; use Win32.Winnls;
procedure Controller is
Server_Name : OLE.OLE_String.Class;
LpCLSID : aliased CLSID;
Status : Win32.Objbase.HRESULT;
begin
OLE.OLE_String.Construct (Server_Name,"Excel.Application");
Status :=
CLSIDFromProgID(OLE.OLE_String.LPCOLESTR(Server_Name),LpCLSID'Access);
if FAILED (Win32.Winerror.HRESULT (Status)) then
raise PROGRAM_ERROR;
end if;
end Controller;
package OLE is
end OLE;
with Ada.Finalization;
with OLE.OLE_String_Rep;
with Win32.Objbase;
package OLE.OLE_String is
type Class is new Ada.Finalization.Limited_Controlled with private;
procedure Construct (Object : in out Class;
Value : in String);
function LPCOLESTR (Object : in Class) return
Win32.Objbase.LPCOLESTR;
private
type Class is new Ada.Finalization.Limited_Controlled with record
State : OLE.OLE_String_Rep.Class;
end record;
procedure Initialize(Object : in out Class);
procedure Finalize (Object : in out Class);
end OLE.OLE_String;
with Win32.Objbase;
package OLE.OLE_String_Rep is
type Class is private;
procedure Construct (Object : in out Class;
Value : in String);
procedure Destruct (Object : in out Class);
function LPCOLESTR (Object : in Class) return
Win32.Objbase.LPCOLESTR;
private
type State;
type Class is access State;
end OLE.OLE_String_Rep;
package body OLE.OLE_String is
procedure Initialize(Object : in out Class) is
begin
null;
end Initialize;
procedure Finalize (Object : in out Class) is
begin
OLE.OLE_String_Rep.Destruct (Object.State);
end Finalize;
procedure Construct (Object : in out Class;
Value : in String) is
begin
OLE.OLE_String_Rep.Construct (Object.State,Value);
end Construct;
function LPCOLESTR (Object : in Class) return Win32.Objbase.LPCOLESTR is
begin
return OLE.OLE_String_Rep.LPCOLESTR (Object.State);
end LPCOLESTR;
end OLE.OLE_String;
with Ada.Characters.Handling;
with Ada.Unchecked_Deallocation;
package body OLE.OLE_String_Rep is
type OLE_Char_Array is array (Positive range <>) of aliased
Win32.Objbase.OLECHAR;
type OLE_Char_Array_Access is access OLE_Char_Array;
type State is record
The_Array : OLE_Char_Array_Access;
end record;
procedure Construct (Object : in out Class;
Value : in String) is
begin
Object.The_Array := new OLE_Char_Array (1..Value'Length+1);
if Value'Length /= 0 then
declare
WValue : Wide_String := Ada.Characters.Handling.To_Wide_String
(Value);
begin
for Index in Value'First..Value'Last loop
Object.The_Array (Index) := Win32.Objbase.OLECHAR(WValue
(Index));
end loop;
end;
end if;
Object.The_Array (Object.The_Array'Last) := Win32.Objbase.OLECHAR'Val
(0);
end Construct;
procedure Destruct (Object : in out Class) is
procedure Free_OLE_Char_Array_Access is
new Ada.Unchecked_Deallocation
(OLE_Char_Array,OLE_Char_Array_Access);
begin
Free_OLE_Char_Array_Access (Object.The_Array);
end Destruct;
function LPCOLESTR (Object : in Class) return Win32.Objbase.LPCOLESTR is
begin
return Object.The_Array (Object.The_Array'First)'Access;
end LPCOLESTR;
end OLE.OLE_String_Rep;
reply other threads:[~1996-09-25 0:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox