* GNAT 2008 GPL pragma import VC++
@ 2009-01-27 19:30 JJ
2009-01-27 20:28 ` sjw
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: JJ @ 2009-01-27 19:30 UTC (permalink / raw)
I have an Ada program that has a pragma import to a Visual C++
procedure. I have tried several combination's of External_Name (all
uppercase, all lowercase, mixed...) to no avail. I continue to get an
"undefined reference" error during the link.
Anyone have any experience with this?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GNAT 2008 GPL pragma import VC++
2009-01-27 19:30 GNAT 2008 GPL pragma import VC++ JJ
@ 2009-01-27 20:28 ` sjw
2009-01-27 22:28 ` JJ
2009-01-27 22:39 ` JJ
2009-01-27 21:12 ` Per Sandberg
2009-01-27 22:48 ` Manuel Gomez
2 siblings, 2 replies; 6+ messages in thread
From: sjw @ 2009-01-27 20:28 UTC (permalink / raw)
On Jan 27, 7:30 pm, JJ <jayson.prich...@ngc.com> wrote:
> I have an Ada program that has a pragma import to a Visual C++
> procedure. I have tried several combination's of External_Name (all
> uppercase, all lowercase, mixed...) to no avail. I continue to get an
> "undefined reference" error during the link.
>
> Anyone have any experience with this?
No experience with VC++; but you might be having problems with name
mangling? (ie, the c++ compiler decorates the object name of the
function with inscrutable encoding of the parameter/result profile,
thus supporting overloading and possibly other features).
You might try
extern "C" {
int foo(int *bar);
}
which (in GCC at any rate) will generate the symbol foo (or _foo, but
at any rate something easier to manage).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GNAT 2008 GPL pragma import VC++
2009-01-27 20:28 ` sjw
@ 2009-01-27 22:28 ` JJ
2009-01-27 22:39 ` JJ
1 sibling, 0 replies; 6+ messages in thread
From: JJ @ 2009-01-27 22:28 UTC (permalink / raw)
On Jan 27, 3:28 pm, sjw <simon.j.wri...@mac.com> wrote:
> On Jan 27, 7:30 pm, JJ <jayson.prich...@ngc.com> wrote:
>
> > I have an Ada program that has a pragma import to a Visual C++
> > procedure. I have tried several combination's of External_Name (all
> > uppercase, all lowercase, mixed...) to no avail. I continue to get an
> > "undefined reference" error during the link.
>
> > Anyone have any experience with this?
>
> No experience with VC++; but you might be having problems with name
> mangling? (ie, the c++ compiler decorates the object name of the
> function with inscrutable encoding of the parameter/result profile,
> thus supporting overloading and possibly other features).
>
> You might try
> extern "C" {
> int foo(int *bar);
>
> }
>
> which (in GCC at any rate) will generate the symbol foo (or _foo, but
> at any rate something easier to manage).
Thanks. I suspected a mangling problem. I had heard that sometimes
the case of the procedure name has to be different than what is in the
C/C++ code.
I was just trying the extern "C" when I read your post. Still not
success. I even did an created a symbol table and inserted that
symbol into the Ada pragma import. Still getting an "undefined
reference" error on linking.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GNAT 2008 GPL pragma import VC++
2009-01-27 20:28 ` sjw
2009-01-27 22:28 ` JJ
@ 2009-01-27 22:39 ` JJ
1 sibling, 0 replies; 6+ messages in thread
From: JJ @ 2009-01-27 22:39 UTC (permalink / raw)
On Jan 27, 3:28 pm, sjw <simon.j.wri...@mac.com> wrote:
> On Jan 27, 7:30 pm, JJ <jayson.prich...@ngc.com> wrote:
>
> > I have an Ada program that has a pragma import to a Visual C++
> > procedure. I have tried several combination's of External_Name (all
> > uppercase, all lowercase, mixed...) to no avail. I continue to get an
> > "undefined reference" error during the link.
>
> > Anyone have any experience with this?
>
> No experience with VC++; but you might be having problems with name
> mangling? (ie, the c++ compiler decorates the object name of the
> function with inscrutable encoding of the parameter/result profile,
> thus supporting overloading and possibly other features).
>
> You might try
> extern "C" {
> int foo(int *bar);
>
> }
>
> which (in GCC at any rate) will generate the symbol foo (or _foo, but
> at any rate something easier to manage).
One other thought... I am using GPS (Gnat Programming Studio) as my
IDE. Right now I am using the -Idir_to_the_obj_file switch. This
points to the VC++ object file created. Is there something else that
I need in the build process?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GNAT 2008 GPL pragma import VC++
2009-01-27 19:30 GNAT 2008 GPL pragma import VC++ JJ
2009-01-27 20:28 ` sjw
@ 2009-01-27 21:12 ` Per Sandberg
2009-01-27 22:48 ` Manuel Gomez
2 siblings, 0 replies; 6+ messages in thread
From: Per Sandberg @ 2009-01-27 21:12 UTC (permalink / raw)
I Have been working with VC and GNAT and are using the following setup.
Rules for the C/C++ code (VC).
* Always build DLL:s
* use external C convention
* use plain C in the interface.
Then my experience is that it almost always works.
/Per
If you post a sniped with the C code and corresponding Ada code along
with the error log, maybe i could pinpoint the problem.
JJ wrote:
> I have an Ada program that has a pragma import to a Visual C++
> procedure. I have tried several combination's of External_Name (all
> uppercase, all lowercase, mixed...) to no avail. I continue to get an
> "undefined reference" error during the link.
>
> Anyone have any experience with this?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: GNAT 2008 GPL pragma import VC++
2009-01-27 19:30 GNAT 2008 GPL pragma import VC++ JJ
2009-01-27 20:28 ` sjw
2009-01-27 21:12 ` Per Sandberg
@ 2009-01-27 22:48 ` Manuel Gomez
2 siblings, 0 replies; 6+ messages in thread
From: Manuel Gomez @ 2009-01-27 22:48 UTC (permalink / raw)
On 27 ene, 20:30, JJ <jayson.prich...@ngc.com> wrote:
> I have an Ada program that has a pragma import to a Visual C++
> procedure. I have tried several combination's of External_Name (all
> uppercase, all lowercase, mixed...) to no avail. I continue to get an
> "undefined reference" error during the link.
>
> Anyone have any experience with this?
Take a look at this Ada wikibook page:
http://en.wikibooks.org/wiki/Ada_Programming/Platform/Windows/Visual_C%2B%2B_-_GNAT_interface
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-01-27 22:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-27 19:30 GNAT 2008 GPL pragma import VC++ JJ
2009-01-27 20:28 ` sjw
2009-01-27 22:28 ` JJ
2009-01-27 22:39 ` JJ
2009-01-27 21:12 ` Per Sandberg
2009-01-27 22:48 ` Manuel Gomez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox