为什么LoadLibrary不能使用给定的路径?(Why LoadLibrary not working with the given path?)
我正在尝试调用
LoadLibrary
方法,但它返回0.Marshal.GetLastWin32Error
返回126(找不到指定的模块。)。码:
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)] static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName); string path = @"C:\junk\测试\BlueStacksKK_DeployTool_2.5.48.7209_china_gmgr\ProgramFiles\BstkC.dll"; IntPtr ptr = LoadLibrary(path); int error = Marshal.GetLastWin32Error();
但是,如果我将此文件移动到其他位置,如
C:\Test\BstkC.dll
,它可以正常工作。问题可能是由于路径上的
测试
。 因此,如果我们使用除英语之外的其他语言,那么它将如何运作。仅供参考。
File.Exists(path)
返回true。I'm trying to call
LoadLibrary
method, But it returns 0.Marshal.GetLastWin32Error
is returning 126 (The specified module could not be found.).Code:
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Ansi)] static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string lpFileName); string path = @"C:\junk\测试\BlueStacksKK_DeployTool_2.5.48.7209_china_gmgr\ProgramFiles\BstkC.dll"; IntPtr ptr = LoadLibrary(path); int error = Marshal.GetLastWin32Error();
But If I move this file to some other location like
C:\Test\BstkC.dll
, it works fine.Issue could be due to
测试
in path. So If we have direcotry in other languages other then English, how will it work.Just for your information.
File.Exists(path)
returns true.
原文:https://stackoverflow.com/questions/40907264
最满意答案
Spring Roo在其_entity.aj方面对其自己的ID字段进行了gerate。 因此,“base”类中不需要使用@ID标记的额外字段。 Roo的管理ID字段应该由Roo的DataOnDemand填充。
默认情况下,roo托管ID的数据库列为“id”。 如果您需要其他列名称(例如,以匹配数据库模式),则可以通过
@RooEntity.identifierColumn
指定该列。Spring Roo gerates it own ID field, in its _entity.aj aspect. So no extra field marked with @ID is needed in the "base"-class. The Roo managed ID field should be populated by Roo's DataOnDemand.
The data base column for the roo managed id is "id" by default. If you need an other colum name (for example to match the database schema) then the column could be specified by the
@RooEntity.identifierColumn
.
相关问答
更多-
请注意,Spring Roo和JBoss Seam不能直接比较,因为JBoss Seam本身不提供问题中提到的CRUD应用程序生成。 但是JBoss Seam随附了seam-gen工具,它提供了这个功能。 因此,将JBoss Seam与Spring框架进行比较可能会更好,并将seam-gen工具与Spring Roo进行比较。 我知道这也不是一个完整的比较,但是我猜这不在这个topice之内。 需要说明的是,在下面的答案中,当我提到JBoss Seam时,其实我指的是JBoss Seam与seam-gen工 ...
-
为了一致性,我会编写setKey()方法。 但是你不会因为不这样做而造成任何问题。 I would write the setKey() method just for consistency. But you are not causing any problems by not doing this.
-
你在Eclipse中安装了STS和WTP吗? 您是否在Roo控制台中尝试了以下操作: perform eclipse ? Have you STS and WTP installed in your Eclipse? Did you tried the following in the Roo console: perform eclipse ?
-
您似乎没有将EntityManager和相关的应用程序上下文注入到测试中。 请尝试在类声明上方添加以下行。 @ContextConfiguration(locations = { "/META-INF/spring/applicationContext.xml","/META-INF/spring/applicationContext-security.xml" }) 并尝试使您的测试类从AbstractJUnit4SpringContextTests进入inhert。 请记住,您可能必须为要执行的某些操 ...
-
我猜你试图删除一条从其他表中引用记录的记录。 删除PizzaOrder时它应该可以正常工作。 但是如果您尝试删除Pizza,那么在PizzaOrder中存在一些数据,您无法执行此操作,因为它未配置为在删除时级联。 I guess you were trying to delete a record that was referring a record from other table. When you delete a PizzaOrder it should work fine. But with s ...
-
Spring Roo @Id字段未在DataOnDemand测试中填充(Spring Roo @Id field not populated in DataOnDemand test)[2021-11-27]
Spring Roo在其_entity.aj方面对其自己的ID字段进行了gerate。 因此,“base”类中不需要使用@ID标记的额外字段。 Roo的管理ID字段应该由Roo的DataOnDemand填充。 默认情况下,roo托管ID的数据库列为“id”。 如果您需要其他列名称(例如,以匹配数据库模式),则可以通过@RooEntity.identifierColumn指定该列。 Spring Roo gerates it own ID field, in its _entity.aj aspect. So ... -
您可以在Roo会话期间偶然切换到Entitet 。 明确目标类: field reference --fieldName Entitet --type ~.domain.Entitet --class ~.domain.Opcina 或者首先切换焦点: focus --class ~.domain.Opcina field reference --fieldName Entitet --type ~.domain.Entitet You could have switched over to Entit ...
-
您可以使用Springsource Tool Suite(STS)上提供的Roo命令向导。 You can use the Roo Command Wizard available on the Springsource Tool Suite (STS).
-
您似乎已尝试将GWT和Spring MVC控制器用于Web应用程序。 只使用一个,它会工作。 与Roo一起欢呼和最好的。 :) It appears that you have tried to use both GWT and Spring MVC Controllers for your web application. Use only one, and it would work. Cheers and all the best with Roo. :)
-
Spring Roo和AOP(Spring Roo and AOP)[2023-09-12]
因此,在我花时间分析问题之后,似乎不是Roo本身从classpath中删除了aspectj jars而是在versin 2.7中删除了eclipse-Plugin(这是由command> roo项目引起的)。 我不知道这是一个错误还是一个功能,但创建一个带有该插件的eclipse项目删除了这个jar。 切换到2.8解决了问题。 所以作为回答: - >使用进一步的运行时编织 - >魔术发生在eclipse-plugin中 So, after I took the time to analyze the pro ...