comp.lang.ada
 help / color / mirror / Atom feed
* Linking/aspect error. [OpenGL]
@ 2012-10-12 22:07 Shark8
  2012-10-13  5:06 ` Shark8
  2012-10-13  7:59 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 4+ messages in thread
From: Shark8 @ 2012-10-12 22:07 UTC (permalink / raw)


I've been making an Open-GL binding for Ada2012, the most tedious part was getting the parameters typed such that a function cannot call one of the OpenGL functions with bad enumeration arguments.

Anyway, trying to link this spits out a bunch of errors:
[...]
C:\Programming\Projects\TAO_GL\obj\TAO_gl.Functions.o:TAO_gl.Functions.adb:(.text+0x2178): undefined reference to `glendlist@0'
C:\Programming\Projects\TAO_GL\obj\TAO_gl.Functions.o:TAO_gl.Functions.adb:(.text+0x8378): undefined reference to `glinitnames@0'
C:\Programming\Projects\TAO_GL\obj\TAO_gl.Functions.o:TAO_gl.Functions.adb:(.text+0x8428): undefined reference to `glPopName'
collect2: ld returned 1 exit status

Taking the last entry, the one for glPopName corresponds to the following in TAO_GL.Functions.adb:
    procedure glPopName
	with Import, Convention => stdcall[, link_name => "glPopName"];
However, that particular error goes away if I use this form:
    procedure glPopName; Pragma Import (StdCall, glPopName, "glPopName");

{Omission of the link_name aspect makes the error display `glPopName@0'}

My question is why the difference? Shouldn't the Import/convention/link_name be exactly equivalent to using the import pragma?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linking/aspect error. [OpenGL]
  2012-10-12 22:07 Linking/aspect error. [OpenGL] Shark8
@ 2012-10-13  5:06 ` Shark8
  2012-10-13  7:59 ` Dmitry A. Kazakov
  1 sibling, 0 replies; 4+ messages in thread
From: Shark8 @ 2012-10-13  5:06 UTC (permalink / raw)


I found that it was External_Name rather than Link_name that was giving the error.
I'm still a bit puzzled on why the Link_Name had any impact on the errors though.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linking/aspect error. [OpenGL]
  2012-10-12 22:07 Linking/aspect error. [OpenGL] Shark8
  2012-10-13  5:06 ` Shark8
@ 2012-10-13  7:59 ` Dmitry A. Kazakov
  2012-10-13 14:37   ` Shark8
  1 sibling, 1 reply; 4+ messages in thread
From: Dmitry A. Kazakov @ 2012-10-13  7:59 UTC (permalink / raw)


On Fri, 12 Oct 2012 15:07:19 -0700 (PDT), Shark8 wrote:

> Taking the last entry, the one for glPopName corresponds to the following in TAO_GL.Functions.adb:
>     procedure glPopName
> 	with Import, Convention => stdcall[, link_name => "glPopName"];
> However, that particular error goes away if I use this form:
>     procedure glPopName; Pragma Import (StdCall, glPopName, "glPopName");
> 
> {Omission of the link_name aspect makes the error display `glPopName@0'}
> 
> My question is why the difference? Shouldn't the
> Import/convention/link_name be exactly equivalent to using the import
> pragma?

In pragma you specified the external name, in aspect you did the link name
(J.15.5). The link name (proper name of the entry point) has the @n suffix.
The compiler knows how to mangle the external name in order to get at the
link name. Normally you should not interfere.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Linking/aspect error. [OpenGL]
  2012-10-13  7:59 ` Dmitry A. Kazakov
@ 2012-10-13 14:37   ` Shark8
  0 siblings, 0 replies; 4+ messages in thread
From: Shark8 @ 2012-10-13 14:37 UTC (permalink / raw)
  Cc: mailbox

On Saturday, October 13, 2012 2:00:09 AM UTC-6, Dmitry A. Kazakov wrote:
> 
> In pragma you specified the external name, in aspect you did the link name
> (J.15.5). The link name (proper name of the entry point) has the @n suffix.
> The compiler knows how to mangle the external name in order to get at the
> link name. Normally you should not interfere.

I see; I certainly was confusing/misremembering Link_Name and External_Name.
Thank you for the clarification/explanation (and  reference).



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-13 14:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-12 22:07 Linking/aspect error. [OpenGL] Shark8
2012-10-13  5:06 ` Shark8
2012-10-13  7:59 ` Dmitry A. Kazakov
2012-10-13 14:37   ` Shark8

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox