Re: problems with generation of c# wrapper for c++ function with function ptr argument

William S Fulton <[email protected]>
Newsgroups gmane.comp.programming.swig
Message-ID <CANGqftB0QJnkv1MmCbQx4+_TWH78vDJ3J9ezpKyOyPPAG0-QcQ@mail.gmail.com>
On Wed, 19 Feb 2020 at 14:06, Carlos Frederico Biscaya <
[email protected]> wrote:

> Hi guys,
>
> I've started using swig a few months ago and after a few hickups had my
> first functioning c# wrapper. Now I need to create a wrapper in C# that
> wrapps a C++ function that takes a function ptr argument. I used a typedef
> for the function ptr type and the swig macro cs_callback that I found while
> researching how to get this done.
>
> Unfortunatelly I seem to be stuck now.
> AFAIK one of  two things should be happening, which aren't.
>
> 1) the delegate corresponding to my typedef for my function ptr is not
> generated anywhere
>
> typedef void (_stdcall *infobarObserverFunc)(InfoBarData*);
>
> 2) If I try using a typemap for inserting the delegate member into the
> generated class, nothing happens.
>
> I seem to be way out of my depth here and hope, someone can provide me
> with some insight as to what is going wrong. I've attached a minimal
> example that reproducibly gives me headaches and the swig project file
> needed. In my development environment I am using swig 4.0.1.
>
>
> I've tried using -E to see whether something suspicious show up after
> preprocessing.
>
>
cs_callback is not something shipped with SWIG, so I can't help you with
that. Generally, the suggestion is to use directors for callbacks which is
documented and there are C# examples, see Examples/csharp/callback and
Examples/charp/extend.

William

_______________________________________________
Swig-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/swig-user
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.