www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - BCD and OpenSSL

reply Regan Heath <regan netmail.co.nz> writes:
Hi all,

I decided to have another crack at BCD and the openssl headers.  I found a
windows bcdgen binary package, mentioned in the dsource forums, but am having a
little trouble using it.

So far I have a copy of the openssl headers in a directory:

G:\Src\openssl\h\openssl

and plan to port them to D files in:

G:\Src\openssl\d\

so, I fire up bcdgen like so:

G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory

I tried various permutations of the -I option but I dont think it applies here
as I am converting C headers, not C++.  

Anyone have a suggestion?  bcdgen seems to need an option for specifying import
paths or something.

Hopefully I am not being too dense, any help is appreciated.

Regan Heath
Jun 03 2007
next sibling parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Regan Heath wrote:
 Hi all,
...ied various permutations of the -I option but I dont think it applies here
as I am converting C headers, not C++.  

Why wouldn't the -I option apply to C files?
 Anyone have a suggestion?  bcdgen seems to need an option for specifying
import paths or something.
 
 Hopefully I am not being too dense, any help is appreciated.
 
 Regan Heath

Does setting the INCLUDE environment variable do anything? I don't know if it's supposed to, but if you're stuck, well, at least it's something you can try till Gregor gets back to you. --bb
Jun 03 2007
prev sibling next sibling parent Kyle Furlong <kylefurlong gmail.com> writes:
Regan Heath wrote:
 Hi all,
 
 I decided to have another crack at BCD and the openssl headers.  I found a
windows bcdgen binary package, mentioned in the dsource forums, but am having a
little trouble using it.
 
 So far I have a copy of the openssl headers in a directory:
 
 G:\Src\openssl\h\openssl
 
 and plan to port them to D files in:
 
 G:\Src\openssl\d\
 
 so, I fire up bcdgen like so:
 
 G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
 openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
 openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
 openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
 openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
 openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
 openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
 openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
 openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
 openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
 openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
 openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
 openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
 openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
 openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
 openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
 openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory
 
 I tried various permutations of the -I option but I dont think it applies here
as I am converting C headers, not C++.  
 
 Anyone have a suggestion?  bcdgen seems to need an option for specifying
import paths or something.
 
 Hopefully I am not being too dense, any help is appreciated.
 
 Regan Heath

bcd uses gcc-xml to do the C++ parsing, so you need to set the environment variables that it uses in order for it to fuction correctly. Off the top of my head, I think its some variant of CXXFLAGS? Check the gcc-xml docs though.
Jun 03 2007
prev sibling next sibling parent Daniel919 <Daniel919 web.de> writes:
Hi, I put the openssl directory into: C:\bcdgen\gccxml\include
and then used bcdgen from C:\bcdgen\gccxml\include\openssl

But as far as I can remember, the windows package of bcdgen was hanging 
on some files when trying to convert.
The linux version was working. And the generated d files can be used on 
windows, too.
Anyway, just give it a try. Maybe this has been fixed in the meantime.


As I said, a full port of openssl would be nice.
I even thought of some improvements, like using classes:
Instead of SSL_CTX_ctrl(ctx,SSL_CTRL_SESS_TIMEOUTS,0,NULL):
class SSL_CTX {
   void ctrl(...) {...}
}
SSL_CTX ctx;
ctx.ctrl(SSL_CTRL_SESS_TIMEOUTS,0,NULL);
This would even allow IDEs to use code-completion for the ssl
functions, like it's the case with all classes.

Best regards,
Daniel
Jun 03 2007
prev sibling parent reply Gregor Richards <Richards codu.org> writes:
Regan Heath wrote:
 Hi all,
 
 I decided to have another crack at BCD and the openssl headers.  I found a
windows bcdgen binary package, mentioned in the dsource forums, but am having a
little trouble using it.
 
 So far I have a copy of the openssl headers in a directory:
 
 G:\Src\openssl\h\openssl
 
 and plan to port them to D files in:
 
 G:\Src\openssl\d\
 
 so, I fire up bcdgen like so:
 
 G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
 openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
 openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
 openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
 openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
 openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
 openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
 openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
 openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
 openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
 openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
 openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
 openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
 openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
 openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
 openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
 openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory
 
 I tried various permutations of the -I option but I dont think it applies here
as I am converting C headers, not C++.  
 
 Anyone have a suggestion?  bcdgen seems to need an option for specifying
import paths or something.
 
 Hopefully I am not being too dense, any help is appreciated.
 
 Regan Heath

(WTF? People use BCD?) You need to put the include path in CFLAGS for C, or CXXFLAGS for C++. That is: set CFLAGS=-I<your_favorite_path> The -I flag to bcd.gen should be -Iopenssl/ (it's the path prepended to the header names in #include lines) Yeah, I know, bcd.gen isn't well documented ... if people actually use it I may have to get back around to developing it :P - Gregor Richards
Jun 03 2007
next sibling parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Gregor Richards wrote:
 Regan Heath wrote:
 Hi all,

 I decided to have another crack at BCD and the openssl headers.  I 
 found a windows bcdgen binary package, mentioned in the dsource 
 forums, but am having a little trouble using it.

 So far I have a copy of the openssl headers in a directory:

 G:\Src\openssl\h\openssl

 and plan to port them to D files in:

 G:\Src\openssl\d\

 so, I fire up bcdgen like so:

 G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
 openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
 openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
 openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
 openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
 openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
 openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
 openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
 openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
 openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
 openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
 openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
 openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
 openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
 openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
 openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
 openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory

 I tried various permutations of the -I option but I dont think it 
 applies here as I am converting C headers, not C++. 
 Anyone have a suggestion?  bcdgen seems to need an option for 
 specifying import paths or something.

 Hopefully I am not being too dense, any help is appreciated.

 Regan Heath

(WTF? People use BCD?) You need to put the include path in CFLAGS for C, or CXXFLAGS for C++. That is: set CFLAGS=-I<your_favorite_path> The -I flag to bcd.gen should be -Iopenssl/ (it's the path prepended to the header names in #include lines) Yeah, I know, bcd.gen isn't well documented ... if people actually use it I may have to get back around to developing it :P

I was looking into using it to wrap SuperLU after looking at SuperLU's headers and realizing that the API was going to take a lot of work to wrap by hand. However I only managed to get most of the way through installing BCD's prerequisites so far. But I'll probably get back to it before too long. --bb
Jun 03 2007
parent reply Regan Heath <regan netmail.co.nz> writes:
Bill Baxter Wrote:
 Gregor Richards wrote:
 Regan Heath wrote:
 Hi all,

 I decided to have another crack at BCD and the openssl headers.  I 
 found a windows bcdgen binary package, mentioned in the dsource 
 forums, but am having a little trouble using it.

 So far I have a copy of the openssl headers in a directory:

 G:\Src\openssl\h\openssl

 and plan to port them to D files in:

 G:\Src\openssl\d\

 so, I fire up bcdgen like so:

 G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
 openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
 openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
 openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
 openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
 openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
 openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
 openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
 openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
 openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
 openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
 openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
 openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
 openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
 openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
 openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
 openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory

 I tried various permutations of the -I option but I dont think it 
 applies here as I am converting C headers, not C++. 
 Anyone have a suggestion?  bcdgen seems to need an option for 
 specifying import paths or something.

 Hopefully I am not being too dense, any help is appreciated.

 Regan Heath

(WTF? People use BCD?) You need to put the include path in CFLAGS for C, or CXXFLAGS for C++. That is: set CFLAGS=-I<your_favorite_path> The -I flag to bcd.gen should be -Iopenssl/ (it's the path prepended to the header names in #include lines) Yeah, I know, bcd.gen isn't well documented ... if people actually use it I may have to get back around to developing it :P

I was looking into using it to wrap SuperLU after looking at SuperLU's headers and realizing that the API was going to take a lot of work to wrap by hand. However I only managed to get most of the way through installing BCD's prerequisites so far. But I'll probably get back to it before too long.

Yeah, the prereqs almost stopped me from trying it in the first place. First try and I got the prereqs installed, I thought, but the compile wouldn't work (I'm on windows). Next try and half way thru I realised there was a binary package I could download to avoid all this jumping through hoops, so I took it. Ages ago I started writing a BCD program myself, but without the foresight to use an existing compiler front end and XML as an intermediate format. That and I thought writing a compiler might be fun, and enlightening. I managed to write the lexer/tokenizer for C and was working on the C preprocessor when I went away to South America for 6 months. When I got back Gregor had beaten me to it! I think BCD is (and could be much more) hugely useful in D gaining traction, especially if you consider the huge number of C/C++ libraries we could be offering. The web/install idea is genius, that in itself could make people switch. Regan Heath
Jun 04 2007
parent reply Bill Baxter <dnewsgroup billbaxter.com> writes:
Regan Heath wrote:
 Bill Baxter Wrote:
 Gregor Richards wrote:
 Regan Heath wrote:
 Hi all,

 I decided to have another crack at BCD and the openssl headers.  I 
 found a windows bcdgen binary package, mentioned in the dsource 
 forums, but am having a little trouble using it.

 So far I have a copy of the openssl headers in a directory:

 G:\Src\openssl\h\openssl

 and plan to port them to D files in:

 G:\Src\openssl\d\

 so, I fire up bcdgen like so:

 G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
 openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
 openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
 openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
 openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
 openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
 openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
 openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
 openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
 openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
 openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
 openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
 openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
 openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
 openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
 openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
 openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory

 I tried various permutations of the -I option but I dont think it 
 applies here as I am converting C headers, not C++. 
 Anyone have a suggestion?  bcdgen seems to need an option for 
 specifying import paths or something.

 Hopefully I am not being too dense, any help is appreciated.

 Regan Heath

You need to put the include path in CFLAGS for C, or CXXFLAGS for C++. That is: set CFLAGS=-I<your_favorite_path> The -I flag to bcd.gen should be -Iopenssl/ (it's the path prepended to the header names in #include lines) Yeah, I know, bcd.gen isn't well documented ... if people actually use it I may have to get back around to developing it :P

headers and realizing that the API was going to take a lot of work to wrap by hand. However I only managed to get most of the way through installing BCD's prerequisites so far. But I'll probably get back to it before too long.

Yeah, the prereqs almost stopped me from trying it in the first place. First try and I got the prereqs installed, I thought, but the compile wouldn't work (I'm on windows). Next try and half way thru I realised there was a binary package I could download to avoid all this jumping through hoops, so I took it. Ages ago I started writing a BCD program myself, but without the foresight to use an existing compiler front end and XML as an intermediate format. That and I thought writing a compiler might be fun, and enlightening. I managed to write the lexer/tokenizer for C and was working on the C preprocessor when I went away to South America for 6 months. When I got back Gregor had beaten me to it! I think BCD is (and could be much more) hugely useful in D gaining traction, especially if you consider the huge number of C/C++ libraries we could be offering. The web/install idea is genius, that in itself could make people switch. Regan Heath

Where is this mythical Windows binary for BCD that you found? Even searching for "D programming BCD" I still come up with mostly pages about binary coded decimal. --bb
Jun 04 2007
parent reply Frits van Bommel <fvbommel REMwOVExCAPSs.nl> writes:
Bill Baxter wrote:
 Where is this mythical Windows binary for BCD that you found?  Even 
 searching for "D programming BCD" I still come up with mostly pages 
 about binary coded decimal.

It's not linked from the main project page, but it seems to be in the SVN repository: http://dsource.org/projects/bcd/browser/downloads
Jun 04 2007
parent reply Regan Heath <regan netmail.co.nz> writes:
Frits van Bommel Wrote:
 Bill Baxter wrote:
 Where is this mythical Windows binary for BCD that you found?  Even 
 searching for "D programming BCD" I still come up with mostly pages 
 about binary coded decimal.

It's not linked from the main project page, but it seems to be in the SVN repository: http://dsource.org/projects/bcd/browser/downloads

Yep, that's it. I found that link here: http://www.dsource.org/forums/viewtopic.php?t=2504 Regan
Jun 04 2007
parent Bill Baxter <dnewsgroup billbaxter.com> writes:
Regan Heath wrote:
 Frits van Bommel Wrote:
 Bill Baxter wrote:
 Where is this mythical Windows binary for BCD that you found?  Even 
 searching for "D programming BCD" I still come up with mostly pages 
 about binary coded decimal.

SVN repository: http://dsource.org/projects/bcd/browser/downloads

Yep, that's it. I found that link here: http://www.dsource.org/forums/viewtopic.php?t=2504 Regan

Beauty. Thanks. --bb
Jun 04 2007
prev sibling parent Dan <murpsoft hotmail.com> writes:
Gregor Richards Wrote:

 Regan Heath wrote:
 Hi all,
 
 I decided to have another crack at BCD and the openssl headers.  I found a
windows bcdgen binary package, mentioned in the dsource forums, but am having a
little trouble using it.
 
 So far I have a copy of the openssl headers in a directory:
 
 G:\Src\openssl\h\openssl
 
 and plan to port them to D files in:
 
 G:\Src\openssl\d\
 
 so, I fire up bcdgen like so:
 
 G:\Src\openssl\h>bcdgen openssl\ssl.h openssl -b -C
 openssl/ssl.h:173:27: openssl/e_os2.h: No such file or directory
 openssl/ssl.h:176:26: openssl/comp.h: No such file or directory
 openssl/ssl.h:179:25: openssl/bio.h: No such file or directory
 openssl/ssl.h:183:26: openssl/x509.h: No such file or directory
 openssl/ssl.h:185:28: openssl/crypto.h: No such file or directory
 openssl/ssl.h:186:27: openssl/lhash.h: No such file or directory
 openssl/ssl.h:187:28: openssl/buffer.h: No such file or directory
 openssl/ssl.h:189:25: openssl/pem.h: No such file or directory
 openssl/ssl.h:191:26: openssl/kssl.h: No such file or directory
 openssl/ssl.h:192:31: openssl/safestack.h: No such file or directory
 openssl/ssl.h:193:30: openssl/symhacks.h: No such file or directory
 openssl/ssl.h:982:26: openssl/ssl2.h: No such file or directory
 openssl/ssl.h:983:26: openssl/ssl3.h: No such file or directory
 openssl/ssl.h:984:71: openssl/tls1.h: No such file or directory
 openssl/ssl.h:985:46: openssl/dtls1.h: No such file or directory
 openssl/ssl.h:986:27: openssl/ssl23.h: No such file or directory
 
 I tried various permutations of the -I option but I dont think it applies here
as I am converting C headers, not C++.  
 
 Anyone have a suggestion?  bcdgen seems to need an option for specifying
import paths or something.
 
 Hopefully I am not being too dense, any help is appreciated.
 
 Regan Heath

(WTF? People use BCD?) You need to put the include path in CFLAGS for C, or CXXFLAGS for C++. That is: set CFLAGS=-I<your_favorite_path> The -I flag to bcd.gen should be -Iopenssl/ (it's the path prepended to the header names in #include lines) Yeah, I know, bcd.gen isn't well documented ... if people actually use it I may have to get back around to developing it :P - Gregor Richards

I've read almost a dozen different people that want to see BCD's C++ feature's further enhanced. There are an aweful lot of C++ tools and libraries that are useful to only C++ programmers and we want them.
Jun 04 2007