www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - libraries and c++ compatibility

reply "Jason King" <jhking airmail.net> writes:
I'm trying to use ocilib (deimos\ocilib) bindings and having some 
issues.
dmd 2.0.59, Windows 7 64 bit.
I can change sc.ini to get everything to build.
I can compile with dmd myapp.d -I<path_to_deimos> -c, but I can't 
seem to figure out the right switches to make the app find the 
ociliba-dm.lib that I generated.
Using sc.ini seems to work, using the lib environment variable 
seems to work but I'd like to understand how to make the command 
line switches work.

The compiled application hangs the first time it calls an ocilib 
routine and I don't expect you folks to debug that for me but it 
occurred to me that since I have the paid-for version of dmc I 
could try essentially the same code vs. c++ and if it worked that 
would isolate the problem to the ocilib.d header.

I have the same "can't find the library with command line 
switches" problem but I suspect the D fix will help me c++-wise 
as well.  The unique to c++ issue is shows like so.
C:\ocilib\ocilib3.9.3\lib32>dmc myapp.cpp -c 
-Ic:\ocilib\ocilib3.9.3\include

C:\ocilib\ocilib3.9.3\lib32>optlink myapp.obj,,,ociliba-dm.lib
OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

myapp.obj(myapp)
  Error 42: Symbol Undefined _OCI_Cleanup
myapp.obj(myapp)
  Error 42: Symbol Undefined _OCI_GetString
... 7 more, covering all ocilib calls.

running lib -l vs. ociliba-dm.lib shows symbols with   signs 
appended, e.g.
_OCI_Cleanup 0 and _OCI_GetString 8.
I suspect there's some simple disconnect on my part here, but I 
can't see it.
Any assistance deeply appreciated.
May 12 2012
parent reply "dnewbie" <run3 myopera.com> writes:
On Sunday, 13 May 2012 at 02:44:22 UTC, Jason King wrote:
 I'm trying to use ocilib (deimos\ocilib) bindings and having 
 some issues.
 dmd 2.0.59, Windows 7 64 bit.
 I can change sc.ini to get everything to build.
 I can compile with dmd myapp.d -I<path_to_deimos> -c, but I 
 can't seem to figure out the right switches to make the app 
 find the ociliba-dm.lib that I generated.
 Using sc.ini seems to work, using the lib environment variable 
 seems to work but I'd like to understand how to make the 
 command line switches work.

 The compiled application hangs the first time it calls an 
 ocilib routine and I don't expect you folks to debug that for 
 me but it occurred to me that since I have the paid-for version 
 of dmc I could try essentially the same code vs. c++ and if it 
 worked that would isolate the problem to the ocilib.d header.

 I have the same "can't find the library with command line 
 switches" problem but I suspect the D fix will help me c++-wise 
 as well.  The unique to c++ issue is shows like so.
 C:\ocilib\ocilib3.9.3\lib32>dmc myapp.cpp -c 
 -Ic:\ocilib\ocilib3.9.3\include

 C:\ocilib\ocilib3.9.3\lib32>optlink myapp.obj,,,ociliba-dm.lib
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 myapp.obj(myapp)
  Error 42: Symbol Undefined _OCI_Cleanup
 myapp.obj(myapp)
  Error 42: Symbol Undefined _OCI_GetString
 ... 7 more, covering all ocilib calls.

 running lib -l vs. ociliba-dm.lib shows symbols with   signs 
 appended, e.g.
 _OCI_Cleanup 0 and _OCI_GetString 8.
 I suspect there's some simple disconnect on my part here, but I 
 can't see it.
 Any assistance deeply appreciated.
Please try adding `-DOCI_API=__stdcall -DOCI_CHARSET_ANSI` to dmc command line. (check http://orclib.sourceforge.net/doc/html/group__g__install.html) If you get runtime errors, please check your ORACLE_HOME environment variable and make sure your %ORACLE_HOME%\bin directory is in your PATH environment variable.
May 13 2012
parent reply "Jason King" <jhking airmail.net> writes:
.
 C:\ocilib\ocilib3.9.3\lib32>dmc myapp.cpp -c 
 -Ic:\ocilib\ocilib3.9.3\include

 C:\ocilib\ocilib3.9.3\lib32>optlink myapp.obj,,,ociliba-dm.lib
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 myapp.obj(myapp)
 Error 42: Symbol Undefined _OCI_Cleanup
 myapp.obj(myapp)
 Error 42: Symbol Undefined _OCI_GetString
 ... 7 more, covering all ocilib calls.
Please try adding `-DOCI_API=__stdcall -DOCI_CHARSET_ANSI` to dmc command line. (check http://orclib.sourceforge.net/doc/html/group__g__install.html) If you get runtime errors, please check your ORACLE_HOME environment variable and make sure your %ORACLE_HOME%\bin directory is in your PATH environment variable.
Thanks for the help. All I did was generate a OMF library running IMPLIB vs. OCILIBA.DLL. I think your suggestion involves building OCILIB from scratch. Is that right? Rebuilding the library looks like a job and I want to make sure that's what I need to do to proceed.
May 13 2012
parent "dnewbie" <run3 myopera.com> writes:
On Sunday, 13 May 2012 at 19:01:15 UTC, Jason King wrote:
 .
 C:\ocilib\ocilib3.9.3\lib32>dmc myapp.cpp -c 
 -Ic:\ocilib\ocilib3.9.3\include

 C:\ocilib\ocilib3.9.3\lib32>optlink myapp.obj,,,ociliba-dm.lib
 OPTLINK (R) for Win32  Release 7.50B1
 Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

 myapp.obj(myapp)
 Error 42: Symbol Undefined _OCI_Cleanup
 myapp.obj(myapp)
 Error 42: Symbol Undefined _OCI_GetString
 ... 7 more, covering all ocilib calls.
Please try adding `-DOCI_API=__stdcall -DOCI_CHARSET_ANSI` to dmc command line. (check http://orclib.sourceforge.net/doc/html/group__g__install.html) If you get runtime errors, please check your ORACLE_HOME environment variable and make sure your %ORACLE_HOME%\bin directory is in your PATH environment variable.
Thanks for the help. All I did was generate a OMF library running IMPLIB vs. OCILIBA.DLL. I think your suggestion involves building OCILIB from scratch. Is that right?
No. You should add '-DOCI_API=__stdcall -DOCI_CHARSET_ANSI' to dmc when building your c/cpp app.
 Rebuilding the library looks like a job and I want to make sure 
 that's what I need to do to proceed.
May 13 2012