Problem with C# wrapping (EntryPointNotFound)

View: New views
4 Messages — Rating Filter:   Alert me  

Parent Message unknown Problem with C# wrapping (EntryPointNotFound)

by Kazovsky Ilya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello world!

I'm using SWIG to wrap some C library to C#. I have two modules and two classes for this modules (i don't use automatically generated wrappers) . One works properly, but another one does not.

here is an examples:

module1.i:
%module1
%{
#include "../wrappers/module1.h"
%}

extern void* Foo();
....
this one works perfect.

module2.i
%module2.i
%{
#include "../wrappers/module2.h"
%}

extern void* Bar(void*, void*);

it wraps by C function:
SWIGEXPORT void * SWIGSTDCALL CSharp_Bar(void*, void*) {...}

and by C# function:
class module2
{
[DllImport("library", EntryPoint="CSharp_Bar")]
public static extern IntPtr Bar(HandleRef, HandleRef);
}
but when i run program i got this:
Unhandled Exception: System.EntryPointNotFoundException: CSharp_Bar
  at (wrapper managed-to-native) wrappers.module2PINVOKE:Bar(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)

--
Yours faithfully, gIlya.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Problem with C# wrapping (EntryPointNotFound)

by wsfulton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kazovsky Ilya wrote:

> Hello world!
>
> I'm using SWIG to wrap some C library to C#. I have two modules and two
> classes for this modules (i don't use automatically generated wrappers)
> . One works properly, but another one does not.
>
> here is an examples:
>
> module1.i:
> %module1
> %{
> #include "../wrappers/module1.h"
> %}
>
> extern void* Foo();
> ....
> this one works perfect.
>
> module2.i
> %module2.i
> %{
> #include "../wrappers/module2.h"
> %}
>
> extern void* Bar(void*, void*);
>
> it wraps by C function:
> SWIGEXPORT void * SWIGSTDCALL CSharp_Bar(void*, void*) {...}
>
> and by C# function:
> class module2
> {
> [DllImport("library", EntryPoint="CSharp_Bar")]
> public static extern IntPtr Bar(HandleRef, HandleRef);
> }
> but when i run program i got this:
> Unhandled Exception: System.EntryPointNotFoundException: CSharp_Bar
>   at (wrapper managed-to-native)
> wrappers.module2PINVOKE:Bar(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)
>

You probably havn't compiled the generated wrapper into library.dll.
Check using tools like dumpbin or depends.

William

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Problem with C# wrapping (EntryPointNotFound)

by Kazovsky Ilya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2008/5/26 William S Fulton <wsf@...>:
Kazovsky Ilya wrote:
Hello world!

I'm using SWIG to wrap some C library to C#. I have two modules and two classes for this modules (i don't use automatically generated wrappers) . One works properly, but another one does not.

here is an examples:

module1.i:
%module1
%{
#include "../wrappers/module1.h"
%}

extern void* Foo();
....
this one works perfect.

module2.i
%module2.i
%{
#include "../wrappers/module2.h"
%}

extern void* Bar(void*, void*);

it wraps by C function:
SWIGEXPORT void * SWIGSTDCALL CSharp_Bar(void*, void*) {...}

and by C# function:
class module2
{
[DllImport("library", EntryPoint="CSharp_Bar")]
public static extern IntPtr Bar(HandleRef, HandleRef);
}
but when i run program i got this:
Unhandled Exception: System.EntryPointNotFoundException: CSharp_Bar
 at (wrapper managed-to-native) wrappers.module2PINVOKE:Bar(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)


You probably havn't compiled the generated wrapper into library.dll. Check using tools like dumpbin or depends.

William

I'm using Mono to build the project. All generated files are included as external link. Here should be no mistake.


--
Yours faithfully, gIlya.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

Re: Problem with C# wrapping (EntryPointNotFound)

by wsfulton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Kazovsky Ilya wrote:

>
>
> 2008/5/26 William S Fulton <wsf@...
> <mailto:wsf@...>>:
>
>     Kazovsky Ilya wrote:
>
>         Hello world!
>
>         I'm using SWIG to wrap some C library to C#. I have two modules
>         and two classes for this modules (i don't use automatically
>         generated wrappers) . One works properly, but another one does not.
>
>         here is an examples:
>
>         module1.i:
>         %module1
>         %{
>         #include "../wrappers/module1.h"
>         %}
>
>         extern void* Foo();
>         ....
>         this one works perfect.
>
>         module2.i
>         %module2.i
>         %{
>         #include "../wrappers/module2.h"
>         %}
>
>         extern void* Bar(void*, void*);
>
>         it wraps by C function:
>         SWIGEXPORT void * SWIGSTDCALL CSharp_Bar(void*, void*) {...}
>
>         and by C# function:
>         class module2
>         {
>         [DllImport("library", EntryPoint="CSharp_Bar")]
>         public static extern IntPtr Bar(HandleRef, HandleRef);
>         }
>         but when i run program i got this:
>         Unhandled Exception: System.EntryPointNotFoundException: CSharp_Bar
>          at (wrapper managed-to-native)
>         wrappers.module2PINVOKE:Bar(System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef)
>
>
>     You probably havn't compiled the generated wrapper into library.dll.
>     Check using tools like dumpbin or depends.
>
>     William
>
>
> I'm using Mono to build the project. All generated files are included as
> external link. Here should be no mistake.
>

If you are using mono the tools I mentioned will still work. You'll find
that they will verify that the symbol is not compiled into the dll. Also
  make sure your PATH is set up correctly and that you are not pointing
to another dll of the same name.

William

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user