1. About my project

Hello,

I've decide to give Euphoria another try.  Of course I've run into a snag.

I've got a DLL that I wrote in PowerBasic to use an Access database.
I should be able to use it with Euphoria for the same purpose.

The problem is I'm getting an 'invalid routine id' on my call and reading
through the forum hasn't enlightened me. blink

Here's the code...

atom dbSQL
dbSQL = open_dll("dbSQL.dll")
if (dbSQL=0) then
    MsgAbort("Could not open dbSQL.dll")
end if

atom rid_dbOpen
rid_dbOpen = define_c_func(dbSQL, "dbOpen", {C_POINTER}, C_LONG)

global function dbOpen(sequence sPath)
    atom text_ptr, nResult
    text_ptr = allocate_string(sPath)
    nResult = call_func(rid_dbOpen, text_ptr)	-- zero=fail
    return nResult
end function

-----------------------------
rid_dbOpen has a value of 2, which seems a little odd to me unless
part of some vector table, but I don't know the internals of Euphoria.

In any case any helpful solution that gets me moving forward again 
would be greatly appreciated.

I'm working on a windows project.  The intent is a multi-user game.
When I'm done I'll upload the source here.

I'm writing the code for unlimited players, but expect performance to
be limited to a dozen or so.

Anyway, I'm stuck until I get past this hurdle.  Thanks.

new topic     » topic index » view message » categorize

2. Re: About my project

ken mortenson wrote:
> 
> Hello,
> 
> I've decide to give Euphoria another try.  Of course I've run into a snag.
> 
> I've got a DLL that I wrote in PowerBasic to use an Access database.
> I should be able to use it with Euphoria for the same purpose.
> 
> The problem is I'm getting an 'invalid routine id' on my call and reading
> through the forum hasn't enlightened me. blink
> 
> Here's the code...
> 
> atom dbSQL
> dbSQL = open_dll("dbSQL.dll")
> if (dbSQL=0) then
>     MsgAbort("Could not open dbSQL.dll")
> end if
> 
> atom rid_dbOpen
> rid_dbOpen = define_c_func(dbSQL, "dbOpen", {C_POINTER}, C_LONG)
> 
> global function dbOpen(sequence sPath)
>     atom text_ptr, nResult
>     text_ptr = allocate_string(sPath)
>     nResult = call_func(rid_dbOpen, text_ptr)	-- zero=fail
>     return nResult
> end function
> 
> -----------------------------
> rid_dbOpen has a value of 2, which seems a little odd to me unless
> part of some vector table, but I don't know the internals of Euphoria.
> 
> In any case any helpful solution that gets me moving forward again 
> would be greatly appreciated.
> 
> I'm working on a windows project.  The intent is a multi-user game.
> When I'm done I'll upload the source here.
> 
> I'm writing the code for unlimited players, but expect performance to
> be limited to a dozen or so.
> 
> Anyway, I'm stuck until I get past this hurdle.  Thanks.

You need c_func() instead of call_func(). call_func() is for Euphoria functions,
c_func() is for C functions.

http://www.rapideuphoria.com/lib_c_d.htm#c_func

Hope that helps!

--
A complex system that works is invariably found to have evolved from a simple
system that works.
--John Gall's 15th law of Systemantics.

"Premature optimization is the root of all evil in programming."
--C.A.R. Hoare

j.

new topic     » goto parent     » topic index » view message » categorize

3. Re: About my project

Jason Gade wrote:

with regard to...
> > atom rid_dbOpen
> > rid_dbOpen = define_c_func(dbSQL, "dbOpen", {C_POINTER}, C_LONG)
> > 
> > global function dbOpen(sequence sPath)
> >     atom text_ptr, nResult
> >     text_ptr = allocate_string(sPath)
> >     nResult = call_func(rid_dbOpen, text_ptr)	-- zero=fail
> >     return nResult
> > end function
> 
> You need c_func() instead of call_func(). call_func() is for Euphoria
> functions,
> c_func() is for C functions.
> 
> <a
> href="http://www.rapideuphoria.com/lib_c_d.htm#c_func">http://www.rapideuphoria.com/lib_c_d.htm#c_func</a>
> 
> Hope that helps!

What a bonehead I am.  Yes, that got me moving forward again.

I still have issues to work through, but that certain did help.

Thanks, ken.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu