defcfun cannot find foreign function in library

Mirko Vukovic mirko.vukovic at gmail.com
Tue Jun 25 16:43:14 UTC 2013


On Tue, Jun 25, 2013 at 4:22 AM, Luís Oliveira <loliveira at common-lisp.net>wrote:

> Hello Mirko,
>
> On Tue, Jun 25, 2013 at 1:56 AM, Mirko Vukovic <mirko.vukovic at gmail.com>
> wrote:
> > I am trying to link to a VISA library (VISA is used to control data
> > acquisition instruments), visa32.lib compiled for Windows.  The library
> is
> > shipped with Tektronix software.
>
> I'm surprised loading it works. That sounds like a static library.
>

You were correct.  It did not.  I found a dynamically loaded library (dll),
and successfully linking to it.


>
> > Using `nm' I did find:
> > 00000000 I __imp__viOpenDefaultRM at 4
> > 00000000 T _viOpenDefaultRM at 4
>
> This looks like the stdcall calling convention. (See "Name-decoration
> convention" in <
> http://msdn.microsoft.com/en-us/library/zxk0tw93(v=vs.71).aspx>.)
> Passing ":convention :stdcall" to DEFCFUN should work.
>
>
Now that I linked to the correct library, defcfun works:  I already managed
to crash clisp a few times due to access violation errors.  Now I'm off to
learn about passing pointer arguments


> Cheers,
>
> --
> Luís Oliveira
> http://kerno.org/~luis/
>

If anything worth sharing comes out of this effort, I may put it out into
the world.

Mirko
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cffi-devel/attachments/20130625/5bb1377d/attachment.html>


More information about the cffi-devel mailing list