提交 e5812f5c 编写于 作者: T tanghai

1.linux上编译enet OK

2.linux上UNetTest要调用libENet.so,需要设置LD_LIBRARY_PATH以便查找libENet.so
3.UNetTest仍然crash
上级 2c835f07
<Properties StartupItem="Platform\Common\Common.csproj">
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="d:\Source\Egametang\CSharp\Platform\TNetTest\TcpListenerTest.cs">
<Files>
<File FileName="d:\Source\Egametang\CSharp\Platform\TNetTest\TcpListenerTest.cs" Line="4" Column="4" />
</Files>
<MonoDevelop.Ide.Workbench>
<Pads>
<Pad Id="MonoDevelop.NUnit.TestPad">
<State expanded="True">
<Node name="Platform" expanded="True">
<Node name="TNetTest" expanded="True">
<Node name="TNetTest" expanded="True">
<Node name="TServiceTest" selected="True" />
</Node>
</Node>
<Node name="UNetTest" expanded="True">
<Node name="UNetTest" expanded="True" />
</Node>
</Node>
</State>
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
......
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET(CMAKE_USE_RELATIVE_PATHS ON)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "Debug")
ENDIF()
PROJECT(CSharp)
# 设置头文件查找路径
INCLUDE_DIRECTORIES(Platform)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/Platform)
ADD_DEFINITIONS(-DHAS_SOCKLEN_T)
# 子目录
ADD_SUBDIRECTORY(Platform/ENet)
\ No newline at end of file
......@@ -44,12 +44,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{AAD111
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNet", "Platform\UNet\UNet.csproj", "{D0B4CFAC-A368-4742-9863-68776CFA9938}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENet", "Platform\ENet\ENet.vcxproj", "{C9992B7C-313E-4C9F-A954-640D01EDFB58}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UNetTest", "Platform\UNetTest\UNetTest.csproj", "{901A8E5C-C4C6-4C3C-8E18-068D75119F5D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfileExe", "Platform\ProfileExe\ProfileExe.csproj", "{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ENet", "Platform\ENet\ENet.vcxproj", "{C9992B7C-313E-4C9F-A954-640D01EDFB58}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
......@@ -184,20 +184,6 @@ Global
{D0B4CFAC-A368-4742-9863-68776CFA9938}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{D0B4CFAC-A368-4742-9863-68776CFA9938}.Release|Win32.ActiveCfg = Release|Any CPU
{D0B4CFAC-A368-4742-9863-68776CFA9938}.Release|x86.ActiveCfg = Release|Any CPU
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.Build.0 = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.Build.0 = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Any CPU.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.Build.0 = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.Build.0 = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.Build.0 = Release|Win32
{901A8E5C-C4C6-4C3C-8E18-068D75119F5D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{901A8E5C-C4C6-4C3C-8E18-068D75119F5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{901A8E5C-C4C6-4C3C-8E18-068D75119F5D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
......@@ -222,6 +208,20 @@ Global
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Release|Win32.ActiveCfg = Release|Any CPU
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Release|x86.ActiveCfg = Release|Any CPU
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Any CPU.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|Win32.Build.0 = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.ActiveCfg = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Debug|x86.Build.0 = Debug|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Any CPU.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Mixed Platforms.Build.0 = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|Win32.Build.0 = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.ActiveCfg = Release|Win32
{C9992B7C-313E-4C9F-A954-640D01EDFB58}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......@@ -238,8 +238,8 @@ Global
{6CD185D1-08E0-4729-A999-2D5B57BA8193} = {C4C64188-4FAE-4CC3-A9E6-D9D4AF7429B6}
{93FB20CF-827A-4CED-A273-90117EB7192F} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
{D0B4CFAC-A368-4742-9863-68776CFA9938} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{C9992B7C-313E-4C9F-A954-640D01EDFB58} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{901A8E5C-C4C6-4C3C-8E18-068D75119F5D} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{C9992B7C-313E-4C9F-A954-640D01EDFB58} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
EndGlobalSection
EndGlobal
INCLUDE_DIRECTORIES(.)
FILE(GLOB Header "enet/*.h")
FILE(GLOB CCer "*.c")
SET(ENetSrc
${Header}
${CCer}
)
ADD_LIBRARY(ENet SHARED ${ENetSrc})
set_target_properties(ENet PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/"
)
\ No newline at end of file
......@@ -104,26 +104,26 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="callbacks.cc" />
<ClCompile Include="compress.cc" />
<ClCompile Include="host.cc" />
<ClCompile Include="list.cc" />
<ClCompile Include="packet.cc" />
<ClCompile Include="peer.cc" />
<ClCompile Include="protocol.cc" />
<ClCompile Include="unix.cc" />
<ClCompile Include="win32.cc" />
<ClCompile Include="callbacks.c" />
<ClCompile Include="compress.c" />
<ClCompile Include="host.c" />
<ClCompile Include="list.c" />
<ClCompile Include="packet.c" />
<ClCompile Include="peer.c" />
<ClCompile Include="protocol.c" />
<ClCompile Include="unix.c" />
<ClCompile Include="win32.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="callbacks.h" />
<ClInclude Include="enet.h" />
<ClInclude Include="list.h" />
<ClInclude Include="protocol.h" />
<ClInclude Include="time.h" />
<ClInclude Include="types.h" />
<ClInclude Include="unix.h" />
<ClInclude Include="utility.h" />
<ClInclude Include="win32.h" />
<ClInclude Include="enet\callbacks.h" />
<ClInclude Include="enet\enet.h" />
<ClInclude Include="enet\list.h" />
<ClInclude Include="enet\protocol.h" />
<ClInclude Include="enet\time.h" />
<ClInclude Include="enet\types.h" />
<ClInclude Include="enet\unix.h" />
<ClInclude Include="enet\utility.h" />
<ClInclude Include="enet\win32.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
......
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="callbacks.c" />
<ClCompile Include="compress.c" />
<ClCompile Include="host.c" />
<ClCompile Include="list.c" />
<ClCompile Include="packet.c" />
<ClCompile Include="peer.c" />
<ClCompile Include="protocol.c" />
<ClCompile Include="unix.c" />
<ClCompile Include="win32.c" />
</ItemGroup>
<ItemGroup>
<Filter Include="enet">
<UniqueIdentifier>{5b0e5c61-d179-4c41-a760-6154cf2db017}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="enet\callbacks.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\enet.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\list.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\protocol.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\time.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\types.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\unix.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\utility.h">
<Filter>enet</Filter>
</ClInclude>
<ClInclude Include="enet\win32.h">
<Filter>enet</Filter>
</ClInclude>
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -7,7 +7,7 @@ namespace UNet
{
public static class NativeMethods
{
private const string LIB = "ENet.dll";
private const string LIB = "ENet";
public const int ENET_PEER_PACKET_THROTTLE_SCALE = 32;
public const int ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2;
......@@ -20,12 +20,10 @@ namespace UNet
public const uint ENET_HOST_ANY = 0;
public const uint ENET_HOST_BROADCAST = 0xffffffff;
[DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_set_host")
]
[DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_set_host")]
internal static extern int EnetAddressSetHost(ref ENetAddress address, string hostName);
[DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_get_host")
]
[DllImport(LIB, CallingConvention = CallingConvention.Cdecl, EntryPoint = "enet_address_get_host")]
internal static extern int EnetAddressGetHost(
ref ENetAddress address, StringBuilder hostName, uint nameLength);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册