Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function foo(ByVal value As C.IB) As Integer Implements C.IA.foo
- Return value.bar(Me)
- End Function
- Public Function bar(ByVal value As C.IA) As Integer Implements C.IB.bar
- Return value.foo(Me)
- End Function
- Public Interface IA
- Function foo(ByVal value As IB) As Integer
- End Interface
- Public Interface IB
- Function bar(ByVal value As IA) As Integer
- End Interface
- Sub Main()
- Dim a As New A.A
- Dim b As New B.B
- a.foo(b)
- End Sub
- // IFoo.cs: (build IFoo.dll)
- interface IFoo {
- void foo(int i);
- }
- public class FooFactory {
- public static IFoo CreateInstance()
- {
- return (IFoo)Activator.CreateInstance("Foo", "foo").Unwrap();
- }
- }
- // IBar.cs: (build IBar.dll)
- interface IBar {
- void bar(int i);
- }
- public class BarFactory {
- public static IBar CreateInstance()
- {
- return (IBar)Activator.CreateInstance("Bar", "bar").Unwrap();
- }
- }
- // foo.cs: (build Foo.dll, references IFoo.dll and IBar.dll)
- public class Foo : IFoo {
- void foo(int i) {
- IBar objBar = BarFactory.CreateInstance();
- if (i > 0) objBar.bar(i -i);
- }
- }
- // bar.cs: (build Bar.dll, references IBar.dll and IFoo.dll)
- public class Bar : IBar {
- void bar(int i) {
- IFoo objFoo = FooFactory.CreateInstance();
- if (i > 0) objFoo.foo(i -i);
- }
- }
- IFoo objFoo = FooFactory.CreateInstance();
- IFoo objFoo = (IFoo)Activator.CreateInstance("Foo", "foo").Unwrap();
- // foo.h
- #if defined(COMPILING_BAR_DLL)
- inline void foo(int x)
- {
- HMODULE hm = LoadLibrary(_T("foo.dll");
- typedef void (*PFOO)(int);
- PFOO pfoo = (PFOO)GetProcAddress(hm, "foo");
- pfoo(x); // call the function!
- FreeLibrary(hm);
- }
- #else
- extern "C" {
- __declspec(dllexport) void foo(int);
- }
- #endif
Add Comment
Please, Sign In to add comment