Re: Problem calling my C DLL from a IDE created source
- Posted by Robert Craig <rds at RapidEuphoria.com> Mar 08, 2007
- 516 views
Andrew Katz wrote: > I fixed this as follows: > > The C program is: > > int __stdcall __export _dll_entry( int arg ) > { > return (arg + arg); > } > > And the change to the EU code is one line: > > entry = define_c_func (dll, "__dll_entry@4", {C_UINT}, C_UINT) > > ----------------- > > I do think this is a very strange way of doing things. > For example, why does not dll_entry by itself work? Windows dll's and the multiple C calling conventions are needlessly complicated and poorly documented, and aren't fully compatible from one C compiler to the next. Unfortunately Euphoria has to be able to interface with these things. I think they add the "@4" part so the C linker will know how many bytes of arguments are to be passed. > It is important to realize that this was just a test case. I have a long C > procedure which I want to call and not rewrite. You've won more than half the battle just by getting the interface to work. What you do inside your C routine is your business and should be relatively easy. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com