Re: automatic dll wrapping
- Posted by Mark Brown <mabrown at SENET.COM.AU> Apr 14, 2001
- 372 views
This is a multi-part message in MIME format. ------=_NextPart_000_0042_01C0C59D.138FC360 charset="iso-8859-2" Hi Tone. 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. 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. 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 Hi, Yes this has been attempted before. 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. 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 ------=_NextPart_000_0042_01C0C59D.138FC360 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 http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-2"> <META content=3D"MSHTML 5.50.4611.1300" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <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 are=20 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 also=20 "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. The=20 Morfit .h file</FONT></DIV> <DIV><FONT face=3DArial size=3D2>also seems to be pretty simple to parse = compared to=20 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"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-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 title=3Dsmithr at ix.net.au href=3D"mailto:smithr at ix.net.au">Ray = Smith</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUforum at topica.com=20 href=3D"mailto:EUforum 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 = wrapping</DIV> <A = <DIV><FONT face=3DArial size=3D2></FONT> </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 Python=20 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 at=20 some level for sure.</FONT></DIV> <DIV><FONT face=3DArial size=3D2>It would be a good starting point = though and I'm=20 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 the=20 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"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; = BORDER-LEFT: #000000 2px solid; MARGIN-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 title=3Dtone.skoda at siol.net = href=3D"mailto:tone.skoda at siol.net">Tone=20 Skoda</A> </DIV> <DIV style=3D"FONT: 10pt arial"><B>To:</B> <A = title=3DEUforum at topica.com=20 href=3D"mailto:EUforum at topica.com">EUforum</A> </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= ------=_NextPart_000_0042_01C0C59D.138FC360--