Thanks for the information. I have been reading the C External documentation and slowly making progress. It seems to me that it would be a very useful addition to EiffelStudio to have EWG has one of the available tools. In another development environment I have used I could produce wrapper classes for COM objects which was very useful and saved a lot of work.
>
> --- In
[hidden email], "dciphercomputing" <simonwhite@> wrote:
> >
> > Hi
> > I want to use the advantage client engine (ace) for the Advantage
> > Database Server which is simply a Windows dll file (ace32.dll) in an
> > Eiffel project. I believe I have to create an Eiffel wrapper class with
> > a method for every function available in the client engine. However, I
> > am not sure how this is done properly in Eiffel even after reading some
> > of the documentation. So I have included a sample function here in the
> > hopes that someone might be able to show me the basic Eiffel class
> > needed to wrap this function. There is also an ace.h file which I
> > assume will have to be referenced some how.
> > Thanks,Simon
> > Syntax
> > UNSIGNED32 AdsConnect (UNSIGNED8 *pucServerName, ADSHANDLE *phConnect);
> > Parameters
> > pucServerName (I)Full file path of the data dictionary file, server
> > name, or drive letter to which to connect. If the application uses a
> > server name as the parameter, it must include the share name for
> > Windows, path from the root for Linux, or volume name for Novell NetWare
> > as well. For example, use "\\server\share", "\\server\path_from_root",
> > or "\\server\volume". Linux users can also connect to the local machine
> > using a direct path such as "/mydata". All Advantage clients and servers
> > consider either slash type (forward or backslash) to be a path
> > delimiter, this means you could also use a connection path with forward
> > slashes, such as "//server/volume". Linux users should also reference
> > the REPLACE_UNC_SERVER section in the ads.ini documentation.
> > phConnect (O)Return the connection handle if successful.
> > The following items are taken from the ace.h just in case they might be
> > needed by anyone supplying an answer to this post.
> > #ifndef ADSHANDLE_DEFINED #define ADSHANDLE_DEFINED #if defined( x64
> > ) #if defined( ADS_LINUX ) // Long is 64 bits in GCC.
> > typedef unsigned long ADSHANDLE; #else typedef unsigned
> > __int64 ADSHANDLE; #endif #else typedef unsigned long
> > ADSHANDLE; #endif#endif
> > UNSIGNED32 ENTRYPOINT AdsConnect( UNSIGNED8 *pucServerName,
> > ADSHANDLE *phConnect );typedef UNSIGNED32 (WINAPI *ADSCONNECT_PTR)(
> > UNSIGNED8 *pucServerName, ADSHANDLE
> > *phConnect );
> >
> >
> >
> >
> > [Non-text portions of this message have been removed]
> >
>
> Hi Simon,
>
> I'm currently trying to write wrappers for libproj and me too finding trouble expecially with function pointers. Anyway just to take your first example, you should write something similar:
>
> <c side>
> --UNSIGNED32 AdsConnect (UNSIGNED8 *pucServerName, ADSHANDLE *phConnect);
>
> <eiffel side>
> ...
> feature
>
> ads_connect (server_name: POINTER; ads_handle: POINTER) : INTEGER
> --
> external
> "C inline use %"your_include_file_here%""
> alias
> "[
> <put your c calls here as you would have written them on the c side for example>
> return AdsConnect($server_name, $ads_handle);
> ]"
> end
>
> this is an immediate way to get thing working,
>
> more: inside your project's settings in EiffelStudio you have to define the location of the include files and the object files that the c compiler has to load to make the binding.
>
> Anyway you should really read eiffel docs about C externals ;-) they are dense but with a bit of patience and attention you should work it out
>
> In my case I defined the location of libproj header files and then point the object to the import library of libproj.
>
> At this moment I'm able to use the main functions of the libproj API but function pointers seems to be a nightmare ...
>
> If you work it out with them i would like to know how ;-)
>
> There is also an Eiffel Wrapper Generator (EWG) that could help you, but unfortunately in my case I was not able even to compile it as compilation fails and I'm not able to understand why so I give up with it ... may be you're more lucky than me ...
>
> Best regards
>
> --------------------------------------------------------------
> -- Dott. Ing. Luca Paganotti
> -- Via dei Giardini 9
> -- 21035 Cunardo (VA)
> -- 393 1346898
> --------------------------------------------------------------
> -- sourceforge email:
> -- lucapaganotti@...
> --------------------------------------------------------------
> --
>