Interesting! Thank you, I'll try that.

Also thanks Markus Schaber, another thing
to look at. :)

Cheers,

Lukáš Duběda
Director
[T] +420 602 444 164

duber studio(tm)
[M] i...@duber.cz
[W] http://www.duber.cz

[A] R.A.Dvorského 601, Praha 10
[A] 10900, Czech Republic, Europe

On 1.4.2011 8:58, Steve Dower wrote:
You should be able to use ctypes for this. For example, the following
works fine from CPython (I don't have IronPython handy on this
computer):

from ctypes import windll
windll.kernel32.CreateSymbolicLinkA("c:\\py.exe", "c:\\python27\\python.exe", 0)

The only difference may be calling CreateSymbolicLinkW instead of *A -
the return value should be non-zero if it succeeds. Also, if you're
running ipy64.exe you may need to override
CreateSymbolicLinkW.argtypes with suitable values - otherwise it will
assume and it sometimes assumes wrong.

On Fri, Apr 1, 2011 at 17:40, Markus Schaber<m.scha...@3s-software.com>  wrote:
Hi,

Either you create a c# wrapper dll that exposes this function, and reference 
that DLL from Ironpython.

Or you use the clrtype class (which can be found at 
http://ironpython.codeplex.com/wikipage?title=Samples) - this allows you to 
assign c# Attributes to python methods, so you can define the DLLImport method.)

Best regards

Markus Schaber

___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax 
+49-831-54031-50

Email: m.scha...@3s-software.com | Web: http://www.3s-software.com
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: 
http://www.3s-software.com/index.shtml?sample_projects

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade 
register: Kempten HRB 6186 | Tax ID No.: DE 167014915

-----Ursprüngliche Nachricht-----
Von: users-boun...@lists.ironpython.com [mailto:users-
boun...@lists.ironpython.com] Im Auftrag von Lukáš Dubeda
Gesendet: Donnerstag, 31. März 2011 21:43
An: Discussion of IronPython
Betreff: [IronPython] Creating Symbolic Links via IronPython

Hi there everyone,

I've been trying to find a solution for creating Symbolic Links via
IronPython scripting, but it seems there is not a direct way of doing this
via .NET and since I don't know C#, I have hard times "translating" C#
snippets I've found on the net to IronPython. For example:

[Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW",
CharSet=Interop.CharSet.Unicode)] public static extern int
CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int
dwFlags);

So, I thought asking here would probably be the best place for the best
advice (i.e. what to avoid using etc...).

Any advice on this topic would be much appretiated!

Thanks a lot in advance, cheers,

Lukáš Duběda
Director
[T] +420 602 444 164

duber studio(tm)
[M] i...@duber.cz
[W] http://www.duber.cz

[A] R.A.Dvorského 601, Praha 10
[A] 10900, Czech Republic, Europe
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
Users@lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to