« Return to Thread: pointer passing between c# dlls and cpp dlls.

Re: pointer passing between c# dlls and cpp dlls.

by Ashish Shete :: Rate this Message:

Reply to Author | View in Thread

Hi William,

%import directive really helped in this case.

Thanks,

Ashish.
William S Fulton wrote:
Ashish Shete wrote:
  
Hi,

I have 2 cpp dlls say ACPP.dll and BCPP.dll.
ACPP.dll have following class,

class A
{
public:
    A(){};
    int BlahBlah(){};
};

BCPP.dll has following class,
#include "A.h"
class B
{
    A * Arabic;
public:
    B(A * ar)
    {
        Arabic = ar;
    };
    void MakeMyDay()
    {
        Arabic->BlahBlah();
    }
};

as you can see BCPP.dll is dependent on ACPP.dll.

Now the problem:
I need these two as separate c# dlls in a c# application. I am using
SWIG to do this,
I wrap headers for A, and form a ACSharp.dll. Wrapping B should Ideally
generate BCsharp.dll. But to wrap B I need to define some typemaps in my
.i file for B, in order to let SWIG know that B is dependent upon a
class A which is in some other dll.
How can I set the typemap? Please note that I need pointer passing
between two C# dlls and C# to cpp dll.
I have done some experimenting with Typemaps. It successfully genearates
two separate c# dlls, but when I try to pass c# object of A into
constructor of c# object of B, the application crashes. Could anybody
please help me to fix this?

    
Are you using %import which is meant for multiple modules?. The manual 
has information, but you might also want to look at the 
Examples/test-suite/imports* files and associated runtime test in 
Examples/test-suite/csharp/imports_runme.cs.


William

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

  


-- 
Ashish Shete
Member of Technical Staff,
ProtoTech Solutions,
www.ProtoTechSolutions.com

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Swig-user mailing list
Swig-user@...
https://lists.sourceforge.net/lists/listinfo/swig-user

 « Return to Thread: pointer passing between c# dlls and cpp dlls.