[Connect Update 16 C# + C++] Calling methods in DLL (p/invoke)

Ok, so i have some questions regarding the p/invoking of methods out of a dll:

Does this look right for dllimport if both DLLs exist in the same folder? I am using an example project to test with. Both projects work separately, now I just want to understand how i can call a method from managed to native.

 class UstnNative
    {
        [DllImport("TextUpdateCpp.dll", CharSet = CharSet.Unicode)]
        private static extern int createALine(DPoint3d dPoint);

        public static void CreateLine()
        {
            createALine(new DPoint3d(0, 0, 0));
        }
    }

Here's the cpp file method:

void createALine(DPoint3dCR basePt)

{

	EditElementHandle eeh;

	DSegment3d seg;

	seg.Init(basePt, DPoint3d::From(basePt.x + g_1mu * 2, basePt.y + g_1mu));

	ICurvePrimitivePtr pCurve = ICurvePrimitive::CreateLine(seg);

	DraftingElementSchema::ToElement(eeh, *pCurve, nullptr, ACTIVEMODEL->Is3d(), *ACTIVEMODEL);

	eeh.AddToModel();

}

Can I pass in the DPoint3d from GeometryNET.DPoint3d to native Bentley.DPoint3D? Or do i need to use doubles and create a new point in native?

Parents Reply Children
No Data