From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A9343A09E7; Tue, 8 Dec 2020 08:03:13 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CE86D72DE; Tue, 8 Dec 2020 08:03:11 +0100 (CET) Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2106.outbound.protection.outlook.com [40.107.237.106]) by dpdk.org (Postfix) with ESMTP id 7CF1C72D9 for ; Tue, 8 Dec 2020 08:03:09 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SBZVyVSTLYcPdgm30bPosTaoRWoIe7BLsot2vePt9MIXFcVpsnPjV2wAmDZZnhlc7lxQzzPQ24t5Wa0CdsXEnuEi8mw3kHtmCUpyJF3ufe2Asa0gs6Fk7eXFUcGl2S1i7aQnLBMt/3b8jeI9FYhZz5QQ5ur09v6oz54G2qpLHYE590D7bUHVNUXPHEhjVu0pKihzlrqEsuSIFvEGhEg/0Yprvl+nHtebnnYGUw23K7JbjIwqkcsZP4F4aX5ZPlXyvqBud86jSJv93aBMme9HnnSZ0aF7hqBwwdLRPHoT914HZJiX/fFrPPBNnX0W8K1w3qQNopeClbJf3ixtiJwWvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eyatUlRjeJ2O9ALQT5btAswa8SbgITxEhyTe9WXsgxc=; b=QdO/IykxgPNsKvqWk+fOqV3R3JFtXCWixP2xGy+5Dhrz3ZjFOXNxfWlkneRBIOJ3O9x5WS5PKVzKlnmUhwvV80WGJzNtkDKb7a0mOXNLtTVc+0ZY3P2wT6RFz+f8sCWz1ip1npZu9YvSEquhwIo9EzC1TR+m6DJgYr9XKtDTThRtzY+uT9Fm7F1FmXqe6dWxDb2rVPdWzSFNcm0F0hRg6Ge6/IqJ+FAGvv9kO0WQbZcl4P+twSNKxWwcpw2+8S1JIwIXPOoJCezcDH5Qai/TnmWVZowerV7+s4x+7CEnMUkME2DA6UVjDP4ky9tXzqaP7e0Rvl7Fr5l4kb5FLAmf/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eyatUlRjeJ2O9ALQT5btAswa8SbgITxEhyTe9WXsgxc=; b=DUDwldw7CMGVNmRxARa9oAlwKAlsahdeKVjWWwgTMKNd6X68xqurNAtLJbJ8clT51oXGvPvGvLzcdT+H/ADOSTDkoV9dPy6Chng71yX3MREqpTRB5QT+rVOqSga8rmTrGPhaODgsYWn/WnWK0gkgw/S6A4Leo/Vcsllmb9Lwz8Y= Received: from (2603:10b6:300:76::19) by MW4PR21MB1988.namprd21.prod.outlook.com (2603:10b6:303:67::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.2; Tue, 8 Dec 2020 07:03:06 +0000 Received: from MWHPR21MB0765.namprd21.prod.outlook.com ([fe80::d9fe:11ed:cb87:9e36]) by MWHPR21MB0765.namprd21.prod.outlook.com ([fe80::d9fe:11ed:cb87:9e36%10]) with mapi id 15.20.3654.012; Tue, 8 Dec 2020 07:03:06 +0000 From: Narcisa Ana Maria Vasile To: "dev@dpdk.org" , thomas , Dmitry Kozlyuk , "Kadam, Pallavi" CC: "Dmitry Malloy (MESHCHANINOV)" , Omar Cardona , Harini Ramakrishnan , Khoa To , Jie Zhou , Tal Shnaiderman , ranjit.menon , Tyler Retzlaff Thread-Topic: Importing DATA into the application Thread-Index: AdbNLCewmTUDlM8RSJ2xuugtzUjWqg== Date: Tue, 8 Dec 2020 07:03:05 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=852d6afd-3362-4cde-9a85-aa5d9b2135ee; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2020-12-08T04:43:00Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:3:5854:dedb:7a70:6f03] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: fcb6869d-f560-4c53-d5cb-08d89b475051 x-ms-traffictypediagnostic: MW4PR21MB1988: x-ms-exchange-transport-forked: True x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: v+fhmF8hbGROrCWKY0YhWOpVI8S4pB3SCCXKaEvVwY+pg1nVGcz3BsqXlcPQKUE1ovQlBrYao8D8xmNuq1ktWvPXf5mKw0fxUxE1cIcdrdgd1xDvgBaQzA7x4/Fci2bDeaSRjRTRiCm0ab1iWHCJVX2CIM7AYIrSKAiyH2njhfkzwO8Ae/h2j5kfXEBsaA+xn+bsV+Nl453Xf/ErjJrs0nJxFOohKsp7f8rVnFnaEQtU/kiNdTrqPE2O96QsysLTI8RdZ05nrlBJXIjpz1KeJMwlzhKAInmJju3atoXZ6lJNpGSUR+W5D6t4WX6rOE1pKzbYIf/RFRVSLosvITIuL9SxumP+z4LYn+fE8q+GXs8MLsHSAgQ2ocAfCBE1/SjVqiHX7gHo7bENKeFuh7VXpQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR21MB0765.namprd21.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(346002)(376002)(39860400002)(136003)(366004)(166002)(6506007)(5660300002)(83380400001)(4326008)(71200400001)(478600001)(107886003)(8990500004)(9326002)(7696005)(110136005)(186003)(86362001)(2906002)(9686003)(64756008)(8676002)(66476007)(82960400001)(55016002)(66946007)(66446008)(66556008)(33656002)(76116006)(316002)(10290500003)(966005)(8936002)(52536014)(82950400001)(54906003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?gWW2YMSbtjUmw3MCc8Uao+bFMFhu786x70ChZYdnWc2T7d0qnJWE7AzO4VNF?= =?us-ascii?Q?duc1TopnOYDnYR2KTV7y3NbTRzx7U7wHs9gA3JHxAgKbtzTV5LfSDI7i83qO?= =?us-ascii?Q?Cwz6PCa42RUnv9/9KCvHY/wU0811TAVmtTaRHIDk5l33rFCeK2A586GYuTwY?= =?us-ascii?Q?Hrf5lgLUh9Xnq8JJYR2NTcGkKgBHU5MxS7CKhPxJGXDT92ATjromtXcIzHpf?= =?us-ascii?Q?xFdEKxbSKjfiLNXO2l3ksG52/pxRJSG3DZ1bp8lE7M4+I22OiIXxPAoiTq9R?= =?us-ascii?Q?pyRRSyjYiujYOZFZgIO82w0t9IoCgyRrbbfVJQPg+1oU0PWhXfPwq61u9+hZ?= =?us-ascii?Q?rcxEw+cztflIF84CcVvElgefWauhFzCWKd+3nWYxRJGehehnFk2vRX2rwpsO?= =?us-ascii?Q?/Y/HscAGjxMmFNumxEqXw3MOJNa5ZEl/F/ftnUA7SuxjDo0ZxWoHJ2uYNX9S?= =?us-ascii?Q?YxuyB6KBOet1ysiugGztv3G7vuB2xV7Va04xNokBjEENJ5CJ1EzAR/sUE3Fg?= =?us-ascii?Q?wv+s6Zr4eEORswPEZxK9FrIIXW0MpS5wqpbOZXaYdUP3KAVym9aI350T2q0q?= =?us-ascii?Q?2OBcx9ugmqvtNIClXtM8i6dvd8h2DC5RS4TWvhup5DZN4jdfyrwVFnMNcAci?= =?us-ascii?Q?LXxgSxvo4HSO8kPhjb1okdQLAsvyhPCIhrLop0MT53W5YmcQQxoz0SLPwdkb?= =?us-ascii?Q?CL01jk5OTtd0rH5huLNATBJMFV/KMn8hXL1DQcdbPOa55QjH7c7qep56l7ih?= =?us-ascii?Q?SIEYhclfbuhTcaNxqnoZwRd578NSAidPZTLXjkqDHhXmcs6pc1cnlaXoJPuE?= =?us-ascii?Q?2mpJvsCSaP4WTZy4irTL4G4UhRItMSlErtexsZw1Qb2jjD3tF15IVeSSre3n?= =?us-ascii?Q?yUDcTrBUddGHn1tmUltqlWnY5F7gycaDJOshBGphxxnSsosboCxUVBxsBc0a?= =?us-ascii?Q?gk1a6Vcg3zoCZ5xMO62ZAEG0KVHCg0gRoMw2OQgYaha0oqRBLmhPquDYAxJt?= =?us-ascii?Q?WLpU8rmuDWgdptY8D/V5mAOkXOERsGP9C+xCfFue1ZfuCnA=3D?= MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR21MB0765.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fcb6869d-f560-4c53-d5cb-08d89b475051 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Dec 2020 07:03:05.9261 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LUtCLpdjkefkk1lMkKVQIE/lUw/gcNkjF8Z7r2AI2NZNLjZg4dsqv9UCrBP40om6eW4GzuwbOmyyxDGfJ81buA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1988 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] Importing DATA into the application X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, While using the DPDK libs as DLLs, I've ran into some access violation erro= rs. I believe they are caused by some incorrect imports. In Windows, accessing an imported variable is done either by using __declsp= ec(dllimport), or by using an extra level of indirection[1]. Some examples of variables in DPDK that are not declared correctly: rte_cycles.h: extern void (*rte_delay_us)(unsigned int us); rte_mempool.h: extern struct rte_mempool_ops_table rte_mempool_ops_table; rte_lcore.h: RTE_DECLARE_PER_LCORE(unsigned, _lcore_id); (Which expands to = extern __thread unsigned per_lcore__lcore_id) To fix this, we need to add the __declspec(dllimport) keyword to the declar= ations of these symbols. Also, we need to consider that the symbols can be = used both internally(in the same module) and externally (imported by other = modules). We can define a macro that will tell if the symbol is used internally or is= imported by a different DLL. Example: #ifdef RTE_INTERNAL extern void (*rte_delay_us)(unsigned int us); #else __declspec(dllimport) void (*rte_delay_us)(unsigned int us); #endif We can then hide the Windows-specific keywords under a new macro, such as: #define RTE_IMPORT __declspec(dllimport) However, there are a few issues to consider: * We cannot add __declspec(dllimport) when declaring per_lcore__lcore_id f= or example. We cannot have both __thread and __declspec(dllimport) (can't = import thread local variables). Have you discussed/run into these issues before? Let me know what you think= . Thanks, Naty [1] https://docs.microsoft.com/en-us/cpp/build/importing-using-def-files?vi= ew=3Dmsvc-160