1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "sal/config.h"
27 #include "sal/types.h"
29 static HMODULE module
;
31 static FARPROC
getFunction(char const * name
) {
32 return GetProcAddress(module
, name
);
35 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
) {
37 if (fdwReason
== DLL_PROCESS_ATTACH
) {
40 size
= GetModuleFileNameW(hinstDLL
, path
, 32767);
44 path
[size
- 5] = L
'x'; /* ...\jpipe.dll -> ...\jpipx.dll */
45 module
= LoadLibraryExW(path
, NULL
, LOAD_WITH_ALTERED_SEARCH_PATH
);
53 SAL_DLLPUBLIC_EXPORT
void JNICALL
54 Java_com_sun_star_lib_connections_pipe_PipeConnection_createJNI(
55 JNIEnv
* env
, jobject obj_this
, jstring name
)
57 (*(void (*)(JNIEnv
*, jobject
, jstring
))
58 getFunction("PipeConnection_create"))(env
, obj_this
, name
);
61 SAL_DLLPUBLIC_EXPORT
void JNICALL
62 Java_com_sun_star_lib_connections_pipe_PipeConnection_closeJNI(
63 JNIEnv
* env
, jobject obj_this
)
65 (*(void (*)(JNIEnv
*, jobject
))
66 getFunction("PipeConnection_close"))(env
, obj_this
);
69 SAL_DLLPUBLIC_EXPORT jint JNICALL
70 Java_com_sun_star_lib_connections_pipe_PipeConnection_readJNI(
71 JNIEnv
* env
, jobject obj_this
, jobjectArray buffer
, jint len
)
73 return (*(jint (*)(JNIEnv
*, jobject
, jobjectArray
, jint
))
74 getFunction("PipeConnection_read"))(env
, obj_this
, buffer
, len
);
77 SAL_DLLPUBLIC_EXPORT
void JNICALL
78 Java_com_sun_star_lib_connections_pipe_PipeConnection_writeJNI(
79 JNIEnv
* env
, jobject obj_this
, jbyteArray buffer
)
81 (*(void (*)(JNIEnv
*, jobject
, jbyteArray
))
82 getFunction("PipeConnection_write"))(env
, obj_this
, buffer
);
85 SAL_DLLPUBLIC_EXPORT
void JNICALL
86 Java_com_sun_star_lib_connections_pipe_PipeConnection_flushJNI(
87 JNIEnv
* env
, jobject obj_this
)
89 (*(void (*)(JNIEnv
*, jobject
))
90 getFunction("PipeConnection_flush"))(env
, obj_this
);
93 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */