Re: automatic dll wrapping
- Posted by Tone Skoda <tone.skoda at siol.net> Apr 15, 2001
- 410 views
This is a multi-part message in MIME format. ------=_NextPart_000_00CB_01C0C5EA.1C5DC3A0 charset="iso-8859-2" Yes, I'm interested in your code. I wrote 20 kb .h parser yesterday, no testing yet, I think i'll be = debugging it 3 weeks :), and I think I got to deep, because I also = consider #ifdef and macros and here evaluating of expressions is needed. I want to acomplish that there wouldn't be any hand editing needed of = .ew files translated. ----- Original Message -----=20 From: Mark Brown=20 To: EUforum=20 Sent: Sunday, April 15, 2001 3:43 AM Subject: Re: automatic dll wrapping =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D "Before myTopica, I was buried in an avalanche of email. Now, thanks to this free solution, I am on top of my inbox." Get rescued at Hi Tone. =20 I use a parser I created with help from code by Dave Cuny, Buddy Hyleberg and others to do a fair bit of the work to wrap=20 Morfit. =20 It creates an include which wraps all the "define_c_func", "define_c_proc" stuff and also creates another include with empty functions (uses function names etc) that are the actual wrapper functions. These have to be completed by hand (eg peeks, pokes, atom_to_floats etc). It also "imports" all completed functions from the previous Morfit version. =20 It isn't very good code (my parts, not the bits I ripped off others!) but I will send it to you if you like. The Morfit .h file also seems to be pretty simple to parse compared to others I have seen. Good luck with it. Mark=20 ----- Original Message -----=20 From: Ray Smith=20 To: EUforum=20 Sent: Sunday, April 15, 2001 9:53 AM Subject: Re: automatic dll wrapping =20 Look in the archives for SWIG/Euphoria by the great David Cuny!!! SWIG is an Open Source project that is used to wrap DLL's for a number of scripting languages (Perl and Python being the Primary = ones??). SWIG/Euphoria is/was David Cuny's attempt for a Euphoria version. =20 I can't remember how good it was ... it worked at some level for = sure. It would be a good starting point though and I'm sure full of = information for anyone attempting similar things. I also attempted my own version when I was wrapping Allegro without = sucess. =20 If you know pascal the FreePascal people have a H2PAS program which converts C header files to pascal. Again this has limiations but = might prove to have useful code or ideas.=20 Once you can parse a C Header file I believe the code generation = wouldn't be to difficult. Ray Smith. ----- Original Message -----=20 From: Tone Skoda=20 To: EUforum=20 Sent: Monday, April 16, 2001 5:26 AM Subject: automatic dll wrapping =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Maximize your email efficiency with My Topica. Searchable archives, vacation options, and more. Sign up now at I was thinking that it could be possible to make=20 a program which would automatically wrap a dll. It would have .dll and = .h file=20 for input, or maybe just .h file, and output would be one big .ew = file. It=20 could/should also handle strings and structures. My WinMania library=20 could be automatically generated without any work (hand editing)=20 with such program. This is definiteley something that will/should=20 probalby be done sometimes for Eu. euAllegro library could also=20 be generated with such program. It would be like C to Eu=20 translator, but only for functions in dlls. This would be a = challenging task=20 for someone to do. It would basically be a parser (very powerful, like = a C=20 compiler almost) for .h files. Then it would be=20 using C libraries in Euphoria very easy, you would just generate=20 appropriate .ew file for a dll and you could use it like in C but with = Euphoria language. Anybody knows of any limits why this couldn't be = done,=20 anybody thought of this = before?=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ------=_NextPart_000_00CB_01C0C5EA.1C5DC3A0 Content-Type: text/html; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content=3D"text/html; charset=3Diso-8859-2" = http-equiv=3DContent-Type> <META content=3D"MSHTML 5.00.2614.3401" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>Yes, I'm interested in your = code.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I wrote 20 kb .h parser yesterday, no = testing yet,=20 I think i'll be debugging it 3 weeks :), and I think I got to deep, = because I=20 also consider #ifdef and macros and here evaluating of expressions = is=20 needed.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I want to acomplish that there wouldn't = be any hand=20 editing needed of .ew files translated.</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV>----- Original Message ----- </DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: = 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A href=3D"mailto:mabrown at SENET.COM.AU" = title=3Dmabrown at SENET.COM.AU>Mark=20 Brown</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = href=3D"mailto:EUforum at topica.com"=20 title=3DEUforum at topica.com>EUforum</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, April 15, 2001 = 3:43=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: automatic dll = wrapping</DIV> </PRE><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D "Before myTopica, I was buried in an avalanche of email. Now, thanks to this free solution, I am on top of my inbox." Get rescued at <A = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</PRE> <DIV><FONT face=3DArial size=3D2>Hi Tone.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>I use a parser I created with help = from code by=20 Dave Cuny,</FONT></DIV> <DIV><FONT face=3DArial size=3D2>Buddy Hyleberg </FONT><FONT = face=3DArial=20 size=3D2>and others to do a fair bit of the work to wrap = </FONT></DIV> <DIV><FONT face=3DArial size=3D2>Morfit.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>It creates an include which wraps all = the=20 "define_c_func",</FONT></DIV> <DIV><FONT face=3DArial size=3D2>"define_c_proc" stuff and also = creates another=20 include with</FONT></DIV> <DIV><FONT face=3DArial size=3D2>empty functions (uses function names = etc) that=20 are the</FONT></DIV> <DIV><FONT face=3DArial size=3D2>actual wrapper functions. These have = to be=20 completed by</FONT></DIV> <DIV><FONT face=3DArial size=3D2>hand (eg peeks, pokes, atom_to_floats = etc). It=20 also "imports"</FONT></DIV> <DIV><FONT face=3DArial size=3D2>all completed functions from the = previous=20 Morfit version.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>It isn't very good code = (my parts, not the=20 bits I ripped off</FONT></DIV> <DIV><FONT face=3DArial size=3D2>others!) but I will send it to you if = you like.=20 The Morfit .h file</FONT></DIV> <DIV><FONT face=3DArial size=3D2>also seems to be pretty simple to = parse compared=20 to others</FONT></DIV> <DIV><FONT face=3DArial size=3D2>I have seen.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Good luck with it.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Mark</FONT> </DIV> <BLOCKQUOTE dir=3Dltr=20 style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; = MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A href=3D"mailto:smithr at ix.net.au" title=3Dsmithr at ix.net.au>Ray = Smith</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = href=3D"mailto:EUforum at topica.com"=20 title=3DEUforum at topica.com>EUforum</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Sunday, April 15, 2001 = 9:53=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> Re: automatic dll=20 wrapping</DIV><A <DIV><FONT face=3DArial size=3D2></FONT> <DIV></DIV> <DIV><FONT face=3DArial size=3D2>Look in the archives for = SWIG/Euphoria by the=20 great David Cuny!!!</FONT></DIV> <DIV><FONT face=3DArial size=3D2>SWIG is an Open Source project that = is used to=20 wrap DLL's for</FONT></DIV> <DIV><FONT face=3DArial size=3D2>a number of scripting languages = (Perl and=20 Python being the Primary ones??).</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>SWIG/Euphoria is/was David Cuny's = attempt for a=20 Euphoria version. </FONT></DIV> <DIV><FONT face=3DArial size=3D2>I can't remember how good it was = ... it worked=20 at some level for sure.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>It would be a good starting point = though and=20 I'm sure full of information</FONT></DIV> <DIV><FONT face=3DArial size=3D2>for anyone attempting similar=20 things.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>I also attempted my own version = when I was=20 wrapping </FONT><FONT face=3DArial size=3D2>Allegro without = sucess.</FONT></DIV> <DIV><FONT face=3DArial size=3D2></FONT> </DIV> <DIV><FONT face=3DArial size=3D2>If you know pascal the FreePascal = people have a=20 H2PAS program which</FONT></DIV> <DIV><FONT face=3DArial size=3D2>converts C header files to = pascal. Again=20 this has limiations but might</FONT></DIV> <DIV><FONT face=3DArial size=3D2>prove to have useful code or ideas. = </FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Once you can parse a C Header file = I believe=20 the code generation wouldn't</FONT></DIV> <DIV><FONT face=3DArial size=3D2>be to difficult.</FONT></DIV> <DIV> </DIV> <DIV><FONT face=3DArial size=3D2>Ray Smith.</FONT></DIV> <DIV> </DIV> <BLOCKQUOTE=20 style=3D"BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; = MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px"> <DIV style=3D"FONT: 10pt arial">----- Original Message ----- = </DIV> <DIV=20 style=3D"BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: = black"><B>From:</B>=20 <A href=3D"mailto:tone.skoda at siol.net" = title=3Dtone.skoda at siol.net>Tone=20 Skoda</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A=20 href=3D"mailto:EUforum at topica.com" = title=3DEUforum at topica.com>EUforum</A>=20 </DIV> <DIV style=3D"FONT: 10pt arial"><B>Sent:</B> Monday, April 16, = 2001 5:26=20 AM</DIV> <DIV style=3D"FONT: 10pt arial"><B>Subject:</B> automatic dll = wrapping</DIV><PRE></PRE><PRE>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D Maximize your email efficiency with My Topica. Searchable archives, vacation options, and more. Sign up now at <A =3D"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</PRE"> <DIV><FONT face=3DArial size=3D2>I was thinking that it could be = possible to make=20 a program which would automatically wrap a dll. It would have .dll and = .h file=20 for input, or maybe just .h file, and output would be one big .ew = file. It=20 could/should also handle strings and structures. My WinMania = library=20 could be automatically generated without any work (hand editing)=20 with such program. This is definiteley something = that will/should=20 probalby be done sometimes for Eu. euAllegro library could also=20 be generated with such program. It would be like C to = Eu=20 translator, but only for functions in dlls. This would be a = challenging task=20 for someone to do. It would basically be a parser (very powerful, like = a C=20 compiler almost) for .h files.</FONT><FONT face=3DArial size=3D2> Then = it would be=20 using C libraries in Euphoria very easy, you would just generate=20 appropriate .ew file for a dll and you could use it like in C but with = Euphoria language. Anybody knows of any limits why this couldn't be = done,=20 anybody thought of this = before?</FONT></DIV><PRE>=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= <A = =3D"=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= " = <PRE>=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= <A = =3D"=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= " = <PRE>=3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= <A = =3D=3D^=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= ------=_NextPart_000_00CB_01C0C5EA.1C5DC3A0--