Creating 4gl Libraries
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I'm working with 4gl on an HP platform and I've got a number of 4gl modules that do the same sort of thing, namely extract data from lookup tables. I've used them to create a static library and have incorporated this into several programs without problem. As a next step I'd like build a shared library with this code but I don't think this is going to be easy. I've looked at esqlc and concluded that, if it is possible, I'll need to convert the 4gl code and make it thread safe. Even then using it directly from 4gl may be a problem. Can anyone tell me they've done this sort of thing (and if so, how?) or am I just wasting my time. Neil Watson
Neil Watson wrote: > I'm working with 4gl on an HP platform and I've got a number of 4gl > modules that do the same sort of thing, namely extract data from lookup > tables. I've used them to create a static library and have incorporated > this into several programs without problem. OK, that's a good first step. > As a next step I'd like build a shared library with this code but I > don't think this is going to be easy. I've looked at esqlc and concluded > that, if it is possible, I'll need to convert the 4gl code and make it > thread safe. Even then using it directly from 4gl may be a problem. (a) That would be tough - I4GL is not thread safe, and (b) it isn't necessary. Code in shared libraries does not have to be thread safe. > Can anyone tell me they've done this sort of thing (and if so, how?) or > am I just wasting my time. The hard part will be linking the shared libraries correctly, especially on HP-UX. You have to use the loader, ld, directly; you can't use the C compiler to do it. It may sound perverse (it may even be perverse, but I'm going to suggest it anyway). Try to build a shared library for Perl; possibly even DBD::Informix. Look hard at the flags and options used during both the compilation (+z on HP-UX, I believe) and even more particularly during linking of the shared library. Then work out how to mimic that in I4GL. You may (probably will) need to produce the object files, and then invoke the linker/loader more or less directly. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>
In article <391CD731.1F420D71@earthlink.net>, jleffler@earthlink.net says... > Neil Watson wrote: > > > I'm working with 4gl on an HP platform and I've got a number of 4gl > > modules that do the same sort of thing, namely extract data from lookup > > tables. I've used them to create a static library and have incorporated > > this into several programs without problem. ...snip... > It may sound perverse (it may even be perverse, but I'm going > to suggest it anyway). Try to build a shared library for Perl; > possibly even DBD::Informix. Look hard at the flags and options > used during both the compilation (+z on HP-UX, I believe) and > even more particularly during linking of the shared library. > Then work out how to mimic that in I4GL. You may (probably will) > need to produce the object files, and then invoke the linker/loader > more or less directly. > Hmmm, why did I think D4GL/4Js P-code libraries (on most platforms) can behave like shared objects...? I'm talking about 42r hash table and 42m's (42x) being loaded as needed? -- Yours, Andrej Falout, http://www.falout.com ICQ 7628616 ++64.21.607517 #----------------------------------------------------------------- globals "std_disclaimer.4gl" Ask yourself just one question: ' Qu' m's se puede hacer y aprender ? - Propellerhead ReBirth RB-338 manual
Andrej Falout wrote: > Jonathan Leffler <jleffler@earthlink.net> says... > > Neil Watson wrote: > > >[...question snipped...] > >[...answer snipped...] > > Hmmm, why did I think D4GL/4Js P-code libraries (on most platforms) can > behave like shared objects...? I'm talking about 42r hash table and > 42m's (42x) being loaded as needed? Well, they use mmap() to memory map the files. That means that the first user actually reads from disk; the subsequent users get to use the mmap()'ed data which is already in memory. -- Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN #include <disclaimer.h>
HPUX uses the -b flag to ld to create a shared library (lib????.sl) I have been trying to do something similar using ESQL/C and ran into Informix Defect: # 122918 (Cannot Link Static ODBC Driver Into A Shared Library) (I would provide a link for you, but the old "INFORMIX' PROPRIETARY INFORMATION - DO NOT DISTRIBUTE" message makes me think it would not be a good idea. The text above should help anyone with access find the information) The basic problem is that Informix did not compile their libraries with the -fpic or -fPIC cc/gcc option. On HPUX shared libraries must contain position independent code. Since the .a files Informix supplied do not contain PIC, then a static link to them will not produce a working shared library. The defect on Informix's Tech Info Center states a fix is in ODBC driver version 3.32.UC1A4. This is not available yet. I called tech support, and was told it will be in CSDK2.5x (Not released, but supposedly in testing). I am trying to get a Beta release of it due to a project release date that we have here but I am not holding my breath. Rob Gagnon Sr. Systems Analyst Simplified Telesys - Austin, TX "Jonathan Leffler" <jleffler@earthlink.net> wrote in message news:391CD731.1F420D71@earthlink.net... > Neil Watson wrote: > > > I'm working with 4gl on an HP platform and I've got a number of 4gl > > modules that do the same sort of thing, namely extract data from lookup > > tables. I've used them to create a static library and have incorporated > > this into several programs without problem. > > OK, that's a good first step. > > > As a next step I'd like build a shared library with this code but I > > don't think this is going to be easy. I've looked at esqlc and concluded > > that, if it is possible, I'll need to convert the 4gl code and make it > > thread safe. Even then using it directly from 4gl may be a problem. > > (a) That would be tough - I4GL is not thread safe, and > (b) it isn't necessary. > > Code in shared libraries does not have to be thread safe. > > > Can anyone tell me they've done this sort of thing (and if so, how?) or > > am I just wasting my time. > > The hard part will be linking the shared libraries correctly, > especially on HP-UX. You have to use the loader, ld, directly; > you can't use the C compiler to do it. > > It may sound perverse (it may even be perverse, but I'm going > to suggest it anyway). Try to build a shared library for Perl; > possibly even DBD::Informix. Look hard at the flags and options > used during both the compilation (+z on HP-UX, I believe) and > even more particularly during linking of the shared library. > Then work out how to mimic that in I4GL. You may (probably will) > need to produce the object files, and then invoke the linker/loader > more or less directly. > > > > > -- > Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net) > Guardian of DBD::Informix v1.00.PC1 -- see http://www.perl.com/CPAN > #include <disclaimer.h> > > >